2009-12-02 Fumitoshi Ukai <ukai@chromium.org>
[WebKit-https.git] / LayoutTests / websocket / tests / script-tests / url-with-query-for-no-query.js
1 description("Make sure handshake with URL with query components fails against server that doesn't support query component.");
2
3 if (window.layoutTestController)
4     layoutTestController.waitUntilDone();
5
6 var url = "ws://127.0.0.1:8880/websocket/tests/no-query-support?";
7 var handshake_success = false;
8 var ws_location;
9
10 function endTest()
11 {
12     clearTimeout(timeoutID);
13     shouldBeFalse("handshake_success");
14     shouldBeUndefined("ws_location");
15     isSuccessfullyParsed();
16     if (window.layoutTestController)
17         layoutTestController.notifyDone();
18 }
19
20 debug("url=" + url);
21 var ws = new WebSocket(url);
22 ws.onopen = function () {
23     debug("WebSocket is open");
24     handshake_success = true;
25 };
26 ws.onmessge = function (evt) {
27     ws_location = evt.data;
28     debug("received:" + ws_location);
29     ws.close();
30 };
31 ws.onclose = function () {
32     debug("WebSocket is closed");
33     endTest();
34 };
35 var timeoutID = setTimeout("endTest()", 2000);
36
37 var successfullyParsed = true;