JS Test Harness: Remove successfullyParsed from more tests
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hybi / sub-protocol.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 WebSocket handshake success with sub protocol.");
11
12 window.jsTestIsAsync = true;
13 if (window.layoutTestController)
14     layoutTestController.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 0);
15
16 var protocol;
17
18 function endTest()
19 {
20     shouldBe("protocol", '"sub-protocol"');
21     finishJSTest();
22 }
23
24 var url = "ws://localhost:8880/websocket/tests/hybi/protocol-test?protocol=sub-protocol";
25 var ws = new WebSocket(url, "sub-protocol");
26
27 ws.onopen = function()
28 {
29     debug("Connected");
30 };
31
32 ws.onmessage = function (messageEvent)
33 {
34     protocol = messageEvent.data;
35     ws.close();
36 };
37
38 ws.onclose = function()
39 {
40     endTest();
41 };
42
43 function timeOutCallback()
44 {
45     debug("Timed out in state: " + ws.readyState);
46     endTest();
47 }
48
49 var timeoutID = setTimeout(timeOutCallback, 3000);
50
51 </script>
52 <script src="../../../../js-test-resources/js-test-post.js"></script>
53 </body>
54 </html>