Git init
[framework/web/webkit-efl.git] / LayoutTests / http / tests / websocket / tests / hybi / url-with-credential.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 credentail info success.");
12
13 window.jsTestIsAsync = true;
14 if (window.layoutTestController)
15     layoutTestController.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 0);
16
17 var url = "ws://user:pass@127.0.0.1:8880/websocket/tests/hybi/echo-location";
18 var handshake_success = false;
19 var ws_location;
20
21 function endTest()
22 {
23     clearTimeout(timeoutID);
24     shouldBeTrue("handshake_success");
25     shouldBe("ws_location", '"ws://127.0.0.1:8880/websocket/tests/hybi/echo-location"');
26     finishJSTest();
27 }
28
29 debug("url=" + url);
30 var ws = new WebSocket(url);
31 ws.onopen = function () {
32     debug("WebSocket is open");
33     handshake_success = true;
34 };
35 ws.onmessage = function (evt) {
36     ws_location = evt.data;
37     debug("received:" + ws_location);
38     ws.close();
39 };
40 ws.onclose = function () {
41     debug("WebSocket is closed");
42     endTest();
43 };
44 var timeoutID = setTimeout("endTest()", 2000);
45
46 var successfullyParsed = true;
47 </script>
48 <script src="../../../../js-test-resources/js-test-post.js"></script>
49 </body>
50 </html>