2011-07-05 Yuta Kitamura <yutak@chromium.org>
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hixie76 / close-unref-websocket.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("Test if Web Socket is closed while handshaking and unreferenced, it should fire close event at most once.");
12
13 window.jsTestIsAsync = true;
14
15 var countCloseEvent = 0;
16
17 function endTest()
18 {
19     shouldBeGreaterThanOrEqual("1", "countCloseEvent");
20     finishJSTest();
21 };
22
23 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hixie76/hanging-handshake");
24 ws.onclose = function() {
25     countCloseEvent += 1;
26 };
27 ws.close();
28 ws = null;
29 gc();
30 setTimeout("endTest()", 100);
31 var successfullyParsed = true;
32 </script>
33 <script src="../../../../js-test-resources/js-test-post.js"></script>
34 </body>
35 </html>