Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / websocket / handshake-fail-by-more-accept-header.html
blob317b5921c15bd3f19a3c25c95b6779090dafef93
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script src="/js-test-resources/js-test.js"></script>
5 </head>
6 <body>
7 <div id="description"></div>
8 <div id="console"></div>
9 <script>
10 description("Test that WebSocket handshake fails if there are more one Sec-WebSocket-Accept header field in the response.");
12 window.jsTestIsAsync = true;
14 function endTest()
16 clearTimeout(timeoutID);
17 finishJSTest();
20 var url = "ws://localhost:8880/handshake-fail-by-more-accept-header";
21 var ws = new WebSocket(url);
23 ws.onopen = function()
25 testFailed("Unexpectedly Connected.");
28 ws.onmessage = function(messageEvent)
30 testFailed("Unexpectedly Received: '" + messageEvent.data + "'");
33 ws.onclose = function()
35 endTest();
38 ws.onerror = function(errorEvent)
40 testPassed("onerror() was called");
43 function timeOutCallback()
45 debug("Timed out in state: " + ws.readyState);
46 endTest();
49 var timeoutID = setTimeout(timeOutCallback, 3000);
51 </script>
52 </body>
53 </html>