6a1ca7905a0bbe50c8c3bb81e79cdef840edd59b
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hixie76 / url-with-query-for-no-query.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("Make sure handshake with URL with query components fails against server that doesn't support query component.");
11
12 window.jsTestIsAsync = true;
13 if (window.testRunner)
14     testRunner.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 1);
15
16 var url = "ws://127.0.0.1:8880/websocket/tests/hixie76/no-query?";
17 var handshake_success = false;
18 var ws_location;
19
20 function endTest()
21 {
22     clearTimeout(timeoutID);
23     shouldBeFalse("handshake_success");
24     shouldBeUndefined("ws_location");
25     finishJSTest();
26 }
27
28 debug("url=" + url);
29 var ws = new WebSocket(url);
30 ws.onopen = function () {
31     debug("WebSocket is open");
32     handshake_success = true;
33 };
34 ws.onmessge = function (evt) {
35     ws_location = evt.data;
36     debug("received:" + ws_location);
37     ws.close();
38 };
39 ws.onclose = function () {
40     debug("WebSocket is closed");
41     endTest();
42 };
43 var timeoutID = setTimeout("endTest()", 2000);
44
45 </script>
46 <script src="../../../../js-test-resources/js-test-post.js"></script>
47 </body>
48 </html>