2af487a4f8c9c21dc3ae1a86fadefcc914ba419f
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / server-close.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <link rel="stylesheet" href="../../../js-test-resources/js-test-style.css">
5 <script src="../../../js-test-resources/js-test-pre.js"></script>
6 </head>
7 <body>
8 <div id="description"></div>
9 <div id="console"></div>
10 <script type="text/javascript">
11 description("WebSocket: Test server-initiated close.");
12
13 window.jsTestIsAsync = true;
14
15 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/server-close");
16 var closeEvent;
17
18 ws.onopen = function()
19 {
20     debug("Connected");
21 };
22
23 ws.onmessage = function(messageEvent)
24 {
25     debug("Received: " + messageEvent.data);
26 };
27
28 ws.onclose = function(event)
29 {
30     debug("Closed");
31     closeEvent = event;
32     shouldBeTrue("closeEvent.wasClean");
33     finishJSTest();
34 };
35
36 var successfullyParsed = true;
37 </script>
38 <script src="../../../js-test-resources/js-test-post.js"></script>
39 </body>
40 </html>