[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

ukai at chromium.org ukai at chromium.org
Thu Apr 8 00:26:51 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 1675b5289e58f96a22257082c35d801330a5f287
Author: ukai at chromium.org <ukai at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 8 08:32:26 2009 +0000

    2009-12-08  Fumitoshi Ukai  <ukai at chromium.org>
    
            Reviewed by Darin Adler.
    
            Add tests that WebSocket protocol argument works.
            https://bugs.webkit.org/show_bug.cgi?id=3178
    
            * websocket/tests/bad-sub-protocol-expected.txt: Added.
            * websocket/tests/bad-sub-protocol.html: Added.
            * websocket/tests/handshake-fail-by-sub-protocol-mismatch-expected.txt: Added.
            * websocket/tests/handshake-fail-by-sub-protocol-mismatch.html: Added.
            * websocket/tests/protocol-test_wsh.py: Added.
            * websocket/tests/script-tests/bad-sub-protocol.js: Added.
            * websocket/tests/script-tests/handshake-fail-by-sub-protocol-mismatch.js: Added.
            * websocket/tests/script-tests/sub-protocol.js: Added.
            * websocket/tests/sub-protocol-expected.txt: Added.
            * websocket/tests/sub-protocol.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51837 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index cd6462d..a114d35 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2009-12-08  Fumitoshi Ukai  <ukai at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Add tests that WebSocket protocol argument works.
+        https://bugs.webkit.org/show_bug.cgi?id=3178
+
+        * websocket/tests/bad-sub-protocol-expected.txt: Added.
+        * websocket/tests/bad-sub-protocol.html: Added.
+        * websocket/tests/handshake-fail-by-sub-protocol-mismatch-expected.txt: Added.
+        * websocket/tests/handshake-fail-by-sub-protocol-mismatch.html: Added.
+        * websocket/tests/protocol-test_wsh.py: Added.
+        * websocket/tests/script-tests/bad-sub-protocol.js: Added.
+        * websocket/tests/script-tests/handshake-fail-by-sub-protocol-mismatch.js: Added.
+        * websocket/tests/script-tests/sub-protocol.js: Added.
+        * websocket/tests/sub-protocol-expected.txt: Added.
+        * websocket/tests/sub-protocol.html: Added.
+
 2009-12-07  Csaba Osztrogonác  <ossy at webkit.org>
 
         [Qt] Unreviewed fix to make QtBuildBot green.
diff --git a/LayoutTests/websocket/tests/bad-sub-protocol-expected.txt b/LayoutTests/websocket/tests/bad-sub-protocol-expected.txt
new file mode 100644
index 0000000..8574acf
--- /dev/null
+++ b/LayoutTests/websocket/tests/bad-sub-protocol-expected.txt
@@ -0,0 +1,20 @@
+Test WebSocket bad sub-protocol names.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS new WebSocket("ws://127.0.0.1:8880/simple", "") threw exception Error: SYNTAX_ERR: DOM Exception 12.
+PASS new WebSocket("ws://127.0.0.1:8880/simple", "sub protocol") threw exception Error: SYNTAX_ERR: DOM Exception 12.
+PASS new WebSocket("ws://127.0.0.1:8880/simple", "") threw exception Error: SYNTAX_ERR: DOM Exception 12.
+PASS new WebSocket("ws://127.0.0.1:8880/simple", "	") threw exception Error: SYNTAX_ERR: DOM Exception 12.
+PASS new WebSocket("ws://127.0.0.1:8880/simple", "
+") threw exception SyntaxError: Parse error.
+PASS new WebSocket("ws://127.0.0.1:8880/simple", "
+") threw exception SyntaxError: Parse error.
+PASS new WebSocket("ws://127.0.0.1:8880/simple", "") threw exception Error: SYNTAX_ERR: DOM Exception 12.
+PASS new WebSocket("ws://127.0.0.1:8880/simple", "€") threw exception Error: SYNTAX_ERR: DOM Exception 12.
+PASS new WebSocket("ws://127.0.0.1:8880/simple", "あ") threw exception Error: SYNTAX_ERR: DOM Exception 12.
+PASS new WebSocket("ws://127.0.0.1:8880/simple", "￿") threw exception Error: SYNTAX_ERR: DOM Exception 12.
+PASS new WebSocket("ws://127.0.0.1:8880/simple", "") threw exception Error: SYNTAX_ERR: DOM Exception 12.
+PASS new WebSocket("ws://127.0.0.1:8880/simple", "￾") threw exception Error: SYNTAX_ERR: DOM Exception 12.
+PASS new WebSocket("ws://127.0.0.1:8880/simple", "𠀋") threw exception Error: SYNTAX_ERR: DOM Exception 12.
+
diff --git a/LayoutTests/websocket/tests/bad-sub-protocol.html b/LayoutTests/websocket/tests/bad-sub-protocol.html
new file mode 100644
index 0000000..ef07234
--- /dev/null
+++ b/LayoutTests/websocket/tests/bad-sub-protocol.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script src="script-tests/bad-sub-protocol.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/websocket/tests/handshake-fail-by-sub-protocol-mismatch-expected.txt b/LayoutTests/websocket/tests/handshake-fail-by-sub-protocol-mismatch-expected.txt
new file mode 100644
index 0000000..2ba72e7
--- /dev/null
+++ b/LayoutTests/websocket/tests/handshake-fail-by-sub-protocol-mismatch-expected.txt
@@ -0,0 +1,9 @@
+Test WebSocket handshake fail if sub protocol name mismatches.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS protocol is undefined.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/websocket/tests/handshake-fail-by-sub-protocol-mismatch.html b/LayoutTests/websocket/tests/handshake-fail-by-sub-protocol-mismatch.html
new file mode 100644
index 0000000..0957325
--- /dev/null
+++ b/LayoutTests/websocket/tests/handshake-fail-by-sub-protocol-mismatch.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script src="script-tests/handshake-fail-by-sub-protocol-mismatch.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/websocket/tests/protocol-test_wsh.py b/LayoutTests/websocket/tests/protocol-test_wsh.py
new file mode 100644
index 0000000..f43d8e6
--- /dev/null
+++ b/LayoutTests/websocket/tests/protocol-test_wsh.py
@@ -0,0 +1,44 @@
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import cgi
+from mod_pywebsocket import msgutil
+
+
+def web_socket_do_extra_handshake(request):
+    r = request.ws_resource.split('?', 1)
+    if len(r) == 1:
+        return
+    param = cgi.parse_qs(r[1])
+    if 'protocol' in param:
+        request.ws_protocol = param['protocol'][0]
+
+
+def web_socket_transfer_data(request):
+    msgutil.send_message(request, request.ws_protocol)
diff --git a/LayoutTests/websocket/tests/script-tests/bad-sub-protocol.js b/LayoutTests/websocket/tests/script-tests/bad-sub-protocol.js
new file mode 100644
index 0000000..1d8d486
--- /dev/null
+++ b/LayoutTests/websocket/tests/script-tests/bad-sub-protocol.js
@@ -0,0 +1,23 @@
+description("Test WebSocket bad sub-protocol names.");
+
+// Fails if protocol is an empty string.
+shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "")');
+
+// Fails if protocol contains an character less than U+0021.
+shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "sub protocol")');
+shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u0000")');
+shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u0009")');
+shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u000A")');
+shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u000D")');
+shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u001B")');
+
+// Fails if protocol containns an character greater than U+007F.
+shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u0080")');
+shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u3042")');
+shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\uFFFF")');
+shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\uFEFF")');
+shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\uFFFE")');
+// Surrogate pairs
+shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\uD840\uDC0B")');
+
+var successfullyParsed = true;
diff --git a/LayoutTests/websocket/tests/script-tests/handshake-fail-by-sub-protocol-mismatch.js b/LayoutTests/websocket/tests/script-tests/handshake-fail-by-sub-protocol-mismatch.js
new file mode 100644
index 0000000..f728aab
--- /dev/null
+++ b/LayoutTests/websocket/tests/script-tests/handshake-fail-by-sub-protocol-mismatch.js
@@ -0,0 +1,44 @@
+description("Test WebSocket handshake fail if sub protocol name mismatches.");
+
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+
+var protocol;
+
+function endTest()
+{
+    shouldBeUndefined("protocol");
+    clearTimeout(timeoutID);
+    isSuccessfullyParsed();
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+
+var url = "ws://localhost:8880/websocket/tests/protocol-test?protocol=available-protocol";
+var ws = new WebSocket(url, "requestting-protocol");
+
+ws.onopen = function()
+{
+    debug("Connected");
+};
+
+ws.onmessage = function (messageEvent)
+{
+    protocol = messageEvent.data;
+    ws.close();
+};
+
+ws.onclose = function()
+{
+    endTest();
+};
+
+function timeOutCallback()
+{
+    debug("Timed out in state: " + ws.readyState);
+    endTest();
+}
+
+var timeoutID = setTimeout(timeOutCallback, 3000);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/websocket/tests/script-tests/sub-protocol.js b/LayoutTests/websocket/tests/script-tests/sub-protocol.js
new file mode 100644
index 0000000..c384ebe
--- /dev/null
+++ b/LayoutTests/websocket/tests/script-tests/sub-protocol.js
@@ -0,0 +1,44 @@
+description("Test WebSocket handshake success with sub protocol.");
+
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+
+var protocol;
+
+function endTest()
+{
+    shouldBe("protocol", '"sub-protocol"');
+    clearTimeout(timeoutID);
+    isSuccessfullyParsed();
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+
+var url = "ws://localhost:8880/websocket/tests/protocol-test?protocol=sub-protocol";
+var ws = new WebSocket(url, "sub-protocol");
+
+ws.onopen = function()
+{
+    debug("Connected");
+};
+
+ws.onmessage = function (messageEvent)
+{
+    protocol = messageEvent.data;
+    ws.close();
+};
+
+ws.onclose = function()
+{
+    endTest();
+};
+
+function timeOutCallback()
+{
+    debug("Timed out in state: " + ws.readyState);
+    endTest();
+}
+
+var timeoutID = setTimeout(timeOutCallback, 3000);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/websocket/tests/sub-protocol-expected.txt b/LayoutTests/websocket/tests/sub-protocol-expected.txt
new file mode 100644
index 0000000..bcc1ec1
--- /dev/null
+++ b/LayoutTests/websocket/tests/sub-protocol-expected.txt
@@ -0,0 +1,10 @@
+Test WebSocket handshake success with sub protocol.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+Connected
+PASS protocol is "sub-protocol"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/websocket/tests/sub-protocol.html b/LayoutTests/websocket/tests/sub-protocol.html
new file mode 100644
index 0000000..f7ec80f
--- /dev/null
+++ b/LayoutTests/websocket/tests/sub-protocol.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script src="script-tests/sub-protocol.js"></script>
+</body>
+</html>

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list