tizen beta release
[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 <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 credentail info success.");
11
12 window.jsTestIsAsync = true;
13 if (window.layoutTestController)
14     layoutTestController.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 0);
15
16 var url = "ws://user:pass@127.0.0.1:8880/websocket/tests/hybi/echo-location";
17 var handshake_success = false;
18 var ws_location;
19
20 function endTest()
21 {
22     clearTimeout(timeoutID);
23     shouldBeTrue("handshake_success");
24     shouldBe("ws_location", '"ws://127.0.0.1:8880/websocket/tests/hybi/echo-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.onmessage = 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>