2011-07-05 Yuta Kitamura <yutak@chromium.org>
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hixie76 / simple.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("Simple Web Socket test");
12
13 window.jsTestIsAsync = true;
14
15 function endTest()
16 {
17     clearTimeout(timeoutID);
18     finishJSTest();
19 }
20
21 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hixie76/simple");
22 debug("Created a socket to '" + ws.URL + "'; readyState " + ws.readyState + ".");
23
24 ws.onopen = function()
25 {
26     debug("Connected; readyState " + ws.readyState);
27 };
28
29 ws.onmessage = function(messageEvent)
30 {
31     debug("Received: '" + messageEvent.data + "'; readyState " + ws.readyState);
32 };
33
34 ws.onclose = function()
35 {
36     debug("Closed; readyState " + ws.readyState + ".");
37     endTest();
38 };
39
40 function timeOutCallback()
41 {
42     debug("Timed out in state: " + ws.readyState);
43     endTest();
44 }
45
46 var timeoutID = setTimeout(timeOutCallback, 3000);
47
48 var successfullyParsed = true;
49 </script>
50 <script src="../../../../js-test-resources/js-test-post.js"></script>
51 </body>
52 </html>