2a1242e80b713f84e6735175897c73aacac76d98
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hybi / handshake-fail-by-wrong-accept-header.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 handshake fails if the server sends incorrect Sec-WebSocket-Accept header.");
11
12 window.jsTestIsAsync = true;
13 if (window.testRunner)
14     testRunner.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 0);
15
16 var url = "ws://localhost:8880/websocket/tests/hybi/handshake-fail-by-wrong-accept-header";
17 var ws = new WebSocket(url);
18 var closeEvent;
19
20 ws.onopen = function()
21 {
22     testFailed("Connection established.");
23     ws.close();
24 };
25
26 ws.onclose = function(event)
27 {
28     closeEvent = event;
29     shouldBeFalse("closeEvent.wasClean");
30     finishJSTest();
31 };
32
33 </script>
34 <script src="../../../../js-test-resources/js-test-post.js"></script>
35 </body>
36 </html>