JS Test Harness: Remove successfullyParsed from more tests
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hybi / zero-length-text.html
1 <!DOCTYPE HTML>
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>
10 description("Test whether WebSocket handles zero length text frame correctly.");
11
12 window.jsTestIsAsync = true;
13 if (window.layoutTestController)
14     layoutTestController.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 0);
15
16 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hybi/zero-length-text");
17 var closeEvent;
18 var sequence = 0;
19 var receivedText = "";
20 var expectedText = "This first text should be received.This second text should be received, too.";
21
22 ws.onopen = function()
23 {
24     debug("onopen() was called.");
25 };
26
27 ws.onmessage = function(event)
28 {
29     var message = event.data;
30     sequence++;
31     if (sequence > 4) {
32         testFailed("onmessage() was called. (message = \"" + message + "\")");
33     } else {
34         debug("onmessage() was called. (message = \"" + message + "\")");
35         receivedText += message;
36     }
37 };
38
39 ws.onclose = function(event)
40 {
41     debug("onclose() was called.");
42     closeEvent = event;
43     shouldBeTrue("closeEvent.wasClean");
44     shouldBe("sequence", "4");
45     shouldBe("receivedText", "expectedText");
46     finishJSTest();
47 };
48
49 </script>
50 <script src="../../../../js-test-resources/js-test-post.js"></script>
51 </body>
52 </html>