e397b2866109478da6b068bb2826f5e606688c04
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hybi / invalid-masked-frames-from-server.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 aborts the connection when it receives an masked frames from server.");
11
12 window.jsTestIsAsync = true;
13 if (window.testRunner)
14     testRunner.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 0);
15
16 var url = "ws://localhost:8880/websocket/tests/hybi/invalid-masked-frames-from-server";
17 var ws = new WebSocket(url);
18 var closeEvent;
19
20 ws.onopen = function()
21 {
22     debug("onopen() was called.");
23 };
24
25 ws.onmessage = function(event)
26 {
27     var message = event.data;
28     testFailed("onmessage() was called. (message = \"" + message + "\")");
29 };
30
31 ws.onclose = function(event)
32 {
33     closeEvent = event;
34     shouldBeFalse("closeEvent.wasClean");
35     finishJSTest();
36 };
37
38 </script>
39 <script src="../../../../js-test-resources/js-test-post.js"></script>
40 </body>
41 </html>