2011-07-05 Yuta Kitamura <yutak@chromium.org>
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hixie76 / url-with-query.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("Make sure handshake with URL with query components success.");
12
13 window.jsTestIsAsync = true;
14
15 var url = "ws://127.0.0.1:8880/websocket/tests/hixie76/echo-location?q=v";
16 var handshake_success = false;
17 var ws_location;
18
19 function endTest()
20 {
21     clearTimeout(timeoutID);
22     shouldBeTrue("handshake_success");
23     shouldBe("ws_location", "url");
24     finishJSTest();
25 }
26
27 debug("url=" + url);
28 var ws = new WebSocket(url);
29 ws.onopen = function () {
30     debug("WebSocket is open");
31     handshake_success = true;
32 };
33 ws.onmessage = function (evt) {
34     ws_location = evt.data;
35     debug("received:" + ws_location);
36     ws.close();
37 };
38 ws.onclose = function () {
39     debug("WebSocket is closed");
40     endTest();
41 };
42 var timeoutID = setTimeout("endTest()", 2000);
43
44 var successfullyParsed = true;
45 </script>
46 <script src="../../../../js-test-resources/js-test-post.js"></script>
47 </body>
48 </html>