[Mac][Win][WK2] Switch to RFC 6455 protocol for WebSockets
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hixie76 / url-no-trailing-slash.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("URL that doesn't have trailing slash should not emit empty Request-URI.");
11
12 window.jsTestIsAsync = true;
13 if (window.layoutTestController)
14     layoutTestController.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 1);
15
16 var url = "ws://127.0.0.1:8880";
17 var handshake_success = false;
18 var ws_location;
19
20 var ws = new WebSocket(url);
21 ws.onopen = function () {
22     debug("WebSocket is open");
23     handshake_success = true;
24 };
25 ws.onmessage = function (evt) {
26     ws_location = evt.data;
27     debug("received:" + ws_location);
28     ws.close();
29 };
30 ws.onclose = function () {
31     debug("WebSocket is closed");
32     shouldBeTrue("handshake_success");
33     shouldBe("ws_location", '"ws://127.0.0.1:8880/"');
34     finishJSTest();
35 };
36
37 </script>
38 <script src="../../../../js-test-resources/js-test-post.js"></script>
39 </body>
40 </html>