JS Test Harness: Remove successfullyParsed from more tests
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hixie76 / handshake-fail-by-no-cr.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('Handshake should fail when the first line does not end with CRLF.');
11
12 window.jsTestIsAsync = true;
13
14 var connected = false;
15 var origin;
16
17 function endTest() {
18     shouldBeFalse('connected');
19     shouldBeUndefined('origin');
20     clearTimeout(timeoutID);
21     finishJSTest();
22 }
23
24 var url = 'ws://localhost:8880/websocket/tests/hixie76/handshake-fail-by-no-cr';
25 var ws = new WebSocket(url);
26
27 ws.onopen = function()
28 {
29     debug('Connected');
30     connected = true;
31 }
32
33 ws.onmessage = function(messageEvent)
34 {
35     origin = messageEvent.data;
36     debug('origin = ' + origin);
37     ws.close();
38 }
39
40 ws.onclose = function()
41 {
42     endTest();
43 }
44
45 function timeoutCallback()
46 {
47     debug('Timed out (state = ' + ws.readyState + ')');
48     endTest();
49 }
50
51 var timeoutID = setTimeout(timeoutCallback, 3000);
52
53 </script>
54 <script src="../../../../js-test-resources/js-test-post.js"></script>
55 </body>
56 </html>