Remove LayoutTestController and WebKitTestRunner support for Hixie76 WebSockets
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hybi / client-close.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("WebSocket: Test client-initiated close.");
11
12 window.jsTestIsAsync = true;
13
14 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hybi/client-close");
15 var closeEvent;
16 var receivedMessage;
17
18 ws.onopen = function()
19 {
20     debug("Connected");
21     ws.close();
22 };
23
24 ws.onmessage = function(messageEvent)
25 {
26     debug("Received: " + messageEvent.data);
27     receivedMessage = messageEvent.data;
28 };
29
30 ws.onclose = function(event)
31 {
32     debug("Closed");
33     closeEvent = event;
34     shouldBeEqualToString("receivedMessage", "close_frame[:2]='\\x88\\x80'");
35     shouldBeTrue("closeEvent.wasClean");
36     finishJSTest();
37 };
38
39 </script>
40 <script src="../../../../js-test-resources/js-test-post.js"></script>
41 </body>
42 </html>