2010-01-12 Fumitoshi Ukai <ukai@chromium.org>
authorukai@chromium.org <ukai@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Jan 2010 02:09:53 +0000 (02:09 +0000)
committerukai@chromium.org <ukai@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Jan 2010 02:09:53 +0000 (02:09 +0000)
        Reviewed by Darin Adler.

        Add a test of WebSockets for shared workers
        https://bugs.webkit.org/show_bug.cgi?id=33285

        * websocket/tests/workers/resources/worker-simple.js:
        * websocket/tests/workers/shared-worker-simple-expected.txt: Added.
        * websocket/tests/workers/shared-worker-simple.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/websocket/tests/workers/resources/worker-simple.js
LayoutTests/websocket/tests/workers/shared-worker-simple-expected.txt [new file with mode: 0644]
LayoutTests/websocket/tests/workers/shared-worker-simple.html [new file with mode: 0644]

index dc85980..b7f8266 100644 (file)
@@ -1,3 +1,14 @@
+2010-01-12  Fumitoshi Ukai  <ukai@chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Add a test of WebSockets for shared workers
+        https://bugs.webkit.org/show_bug.cgi?id=33285
+
+        * websocket/tests/workers/resources/worker-simple.js:
+        * websocket/tests/workers/shared-worker-simple-expected.txt: Added.
+        * websocket/tests/workers/shared-worker-simple.html: Added.
+
 2010-01-12  Simon Fraser  <simon.fraser@apple.com>
 
         Reviewed by Dan Bernstein.
index 9825b48..e3daffb 100644 (file)
@@ -1,9 +1,9 @@
 if (self.postMessage)
     runTests();
 else
-    onconnect = handleConnect();
+    onconnect = handleConnect;
 
-function handleConnect(evevnt)
+function handleConnect(event)
 {
     // For shared workers, create a faux postMessage() API to send message back to the parent page.
     self.postMessage = function (message) { event.ports[0].postMessage(message); };
@@ -12,6 +12,7 @@ function handleConnect(evevnt)
 
 function runTests()
 {
+    var ws;
     try {
         postMessage("PASS: worker: init");
         if ('WebSocket' in self)
diff --git a/LayoutTests/websocket/tests/workers/shared-worker-simple-expected.txt b/LayoutTests/websocket/tests/workers/shared-worker-simple-expected.txt
new file mode 100644 (file)
index 0000000..86b6bdc
--- /dev/null
@@ -0,0 +1,13 @@
+Test for Web Socket in SharedWorker.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS: worker: init
+PASS: worker: WebSocket exists
+PASS: worker: successfullyParsed:[object WebSocket]
+PASS: worker: Connected.
+PASS: worker: Received: 'Hello from Simple WSH.'
+PASS: worker: Closed.
+DONE
+TEST COMPLETE
+
diff --git a/LayoutTests/websocket/tests/workers/shared-worker-simple.html b/LayoutTests/websocket/tests/workers/shared-worker-simple.html
new file mode 100644 (file)
index 0000000..d279606
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head></head>
+<body>
+<p>Test for Web Socket in SharedWorker.</p>
+<p></p>
+<p>On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".</p>
+<pre id=log>
+</pre>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+    document.getElementById("log").innerHTML += message + "\n";
+}
+
+function endTest()
+{
+    log("TEST COMPLETE");
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+var worker = new SharedWorker('resources/worker-simple.js', 'websocketSimple');
+worker.port.onmessage = function (evt) {
+    log(evt.data);
+    if (evt.data == "DONE")
+        endTest();
+};
+</script>
+</body>
+</html>