JS Test Harness: Remove successfullyParsed from more tests
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hybi / send-after-close-on-unload.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../../js-test-resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <div id="description"></div>
8 <div id="console"></div>
9 <script type="text/javascript">
10 description("Test if Web Socket opened in iframe, referred in parent document is, and try to send() returns false.");
11
12 window.jsTestIsAsync = true;
13 if (window.layoutTestController)
14     layoutTestController.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 0);
15
16 var frameDiv;
17 var closedSocket;
18 document.childWebSocket = null;
19
20 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hybi/close-on-unload");
21 ws.onopen = function()
22 {
23     debug("PASS ws on master document is ready.");
24     frameDiv = document.createElement("iframe");
25     frameDiv.src = "resources/close-on-unload-iframe-reference-in-parent.html";
26     document.body.appendChild(frameDiv);
27     debug("PASS insert a iframe, where open ws called 'socket1'");
28 };
29 ws.onmessage = function(evt)
30 {
31     closedSocket = evt.data;
32     ws.close();
33 };
34 ws.onclose = function()
35 {
36     shouldBe("closedSocket", '"socket1"');
37     shouldBe("document.childWebSocket.readyState", "3");
38     finishJSTest();
39 };
40
41 document.iframeReady = function()
42 {
43     shouldBeNonNull("document.childWebSocket");
44     debug("PASS 'socket1' is sent to the server. unload the iframe. expect receiving 'socket1' on ws...");
45     document.body.removeChild(frameDiv);
46     shouldBeFalse("document.childWebSocket.send('send to closed socket')");
47 };
48
49 </script>
50 <script src="../../../../js-test-resources/js-test-post.js"></script>
51 </body>
52 </html>