2009-11-11 Yuzo Fujishima <yuzo@google.com>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Nov 2009 08:45:09 +0000 (08:45 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Nov 2009 08:45:09 +0000 (08:45 +0000)
        Reviewed by David Levin.

        Add a simple web socket test. This tests basic features of Web Socket.
        This also serves as an example of Web Socket tests.

        https://bugs.webkit.org/show_bug.cgi?id=27492

        * platform/gtk/Skipped:
        * platform/mac/Skipped:
        * platform/qt/Skipped:
        * platform/win/Skipped:
        * websocket/tests/resources/simple.js: Added.
        (ws.onopen):
        (ws.onmessage):
        (ws.onclose):
        (timeOutCallback):
        * websocket/tests/simple-expected.txt: Added.
        * websocket/tests/simple.html: Added.
        * websocket/tests/simple_wsh.py: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@50794 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/gtk/Skipped
LayoutTests/platform/mac/Skipped
LayoutTests/platform/qt/Skipped
LayoutTests/platform/win/Skipped
LayoutTests/websocket/tests/script-tests/TEMPLATE.html [new file with mode: 0644]
LayoutTests/websocket/tests/script-tests/simple.js [new file with mode: 0644]
LayoutTests/websocket/tests/simple-expected.txt [new file with mode: 0644]
LayoutTests/websocket/tests/simple.html [new file with mode: 0644]
LayoutTests/websocket/tests/simple_wsh.py [new file with mode: 0644]

index a8da06ea9fecc1b8cfef2e7d1c2e67d88be68b14..19ecedcf226e4cf46a5eac025bc72602087f9a93 100644 (file)
@@ -1,3 +1,25 @@
+2009-11-11  Yuzo Fujishima  <yuzo@google.com>
+
+        Reviewed by David Levin.
+
+        Add a simple web socket test. This tests basic features of Web Socket.
+        This also serves as an example of Web Socket tests.
+
+        https://bugs.webkit.org/show_bug.cgi?id=27492
+
+        * platform/gtk/Skipped:
+        * platform/mac/Skipped:
+        * platform/qt/Skipped:
+        * platform/win/Skipped:
+        * websocket/tests/resources/simple.js: Added.
+        (ws.onopen):
+        (ws.onmessage):
+        (ws.onclose):
+        (timeOutCallback):
+        * websocket/tests/simple-expected.txt: Added.
+        * websocket/tests/simple.html: Added.
+        * websocket/tests/simple_wsh.py: Added.
+
 2009-11-11  Philippe Normand  <pnormand@igalia.com>
 
         Reviewed by Xan Lopez.
index 226d6b5d8ebaf9abc10bdb55140af22e67910b01..35d9ece61e3c25f02697c6e0fb46fbb4d5b061c7 100644 (file)
@@ -5612,3 +5612,6 @@ fast/ruby/rubyDOM-remove-text2.html
 
 # SVG new tests
 svg/filters/feDisplacementMap.svg
+
+# Missing SocketStreamHandle implementation
+websocket/tests
index 2b33c21d0fccb30e200ad6ffe548c8a4e330eb53..9c9cee7aa38ef388ec3ce5d920ca5d90075e3066 100644 (file)
@@ -96,3 +96,5 @@ media/video-empty-source.html
 # Ruby layout tests somehow cause http/tests/security/mixedContent/about-blank-iframe-in-main-frame.html to fail
 fast/ruby
 
+# Missing SocketStreamHandle implementation
+websocket/tests
index d87e8e19aa42716c6f27868e258f46a984043b39..b5f8ea9384ed3c6b3b10d95214b95e3565206d18 100644 (file)
@@ -5045,3 +5045,6 @@ http/tests/xmlhttprequest/zero-length-response-sync.html
 http/tests/xmlhttprequest/workers/methods-async.html
 http/tests/xmlhttprequest/workers/methods.html
 http/tests/xmlhttprequest/workers/shared-worker-methods-async.html
+
+# Missing SocketStreamHandle implementation
+websocket/tests
index 6bba370735163daf1cd77782255e2bd7e2f51141..bcc33ad3c7b2483fed3bc9b8dae6648355f98ad3 100644 (file)
@@ -679,3 +679,6 @@ fast/ruby
 
 # https://bugs.webkit.org/show_bug.cgi?id=31315
 fast/dom/HTMLObjectElement/children-changed.html
+
+# Missing SocketStreamHandle implementation
+websocket/tests
diff --git a/LayoutTests/websocket/tests/script-tests/TEMPLATE.html b/LayoutTests/websocket/tests/script-tests/TEMPLATE.html
new file mode 100644 (file)
index 0000000..2afc297
--- /dev/null
@@ -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="YOUR_JS_FILE_HERE"></script>
+</body>
+</html>
diff --git a/LayoutTests/websocket/tests/script-tests/simple.js b/LayoutTests/websocket/tests/script-tests/simple.js
new file mode 100644 (file)
index 0000000..cce71fc
--- /dev/null
@@ -0,0 +1,41 @@
+description("Simple Web Socket test");
+
+if (window.layoutTestController) {
+    layoutTestController.waitUntilDone();
+}
+
+function endTest()
+{
+    isSuccessfullyParsed();
+    if (window.layoutTestController) {
+        layoutTestController.notifyDone();
+    }
+}
+
+var ws = new WebSocket("ws://localhost:8880/websocket/tests/simple");
+
+ws.onopen = function()
+{
+    debug("Connected.");
+};
+
+ws.onmessage = function(messageEvent)
+{
+    debug("Received: '" + messageEvent.data + "'");
+};
+
+ws.onclose = function()
+{
+    debug("Closed.");
+    endTest();
+};
+
+function timeOutCallback()
+{
+    debug("Timed out in state: " + ws.readyState);
+    endTest();
+}
+
+window.setTimeout(timeOutCallback, 3000);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/websocket/tests/simple-expected.txt b/LayoutTests/websocket/tests/simple-expected.txt
new file mode 100644 (file)
index 0000000..f7142cf
--- /dev/null
@@ -0,0 +1,10 @@
+Simple Web Socket test
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+Connected.
+Received: 'Hello from Simple WSH.'
+Closed.
+PASS successfullyParsed is true
+
+TEST COMPLETE
diff --git a/LayoutTests/websocket/tests/simple.html b/LayoutTests/websocket/tests/simple.html
new file mode 100644 (file)
index 0000000..817072d
--- /dev/null
@@ -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/simple.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/websocket/tests/simple_wsh.py b/LayoutTests/websocket/tests/simple_wsh.py
new file mode 100644 (file)
index 0000000..fc0271c
--- /dev/null
@@ -0,0 +1,38 @@
+# 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.
+
+
+from mod_pywebsocket import msgutil
+
+
+def web_socket_do_extra_handshake(request):
+    pass # Always accept.
+
+
+def web_socket_transfer_data(request):
+    msgutil.send_message(request, 'Hello from Simple WSH.')