tizen beta release
[profile/ivi/webkit-efl.git] / LayoutTests / http / tests / websocket / tests / hybi / server-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 server-initiated close.");
11
12 window.jsTestIsAsync = true;
13 if (window.layoutTestController)
14     layoutTestController.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 0);
15
16 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hybi/server-close");
17 var closeEvent;
18
19 ws.onopen = function()
20 {
21     debug("Connected");
22 };
23
24 ws.onmessage = function(messageEvent)
25 {
26     debug("Received: " + messageEvent.data);
27 };
28
29 ws.onclose = function(event)
30 {
31     debug("Closed");
32     closeEvent = event;
33     shouldBeTrue("closeEvent.wasClean");
34     finishJSTest();
35 };
36
37 </script>
38 <script src="../../../../js-test-resources/js-test-post.js"></script>
39 </body>
40 </html>