Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / websocket / pong.html
blobc5e87fe51bda3612162480caf4ee8c00bdfa0761
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script src="/js-test-resources/js-test.js"></script>
5 </head>
6 <body>
7 <div id="description"></div>
8 <div id="console"></div>
9 <script>
10 description("Test whether WebSocket correctly responds to a ping message sent from the server.");
12 window.jsTestIsAsync = true;
14 var url = "ws://localhost:8880/pong?payload=Hello,%20World%21";
15 var ws = new WebSocket(url);
16 var closeEvent;
17 var message;
19 ws.onopen = function()
21 debug("onopen() was called.");
24 ws.onmessage = function(event)
26 message = event.data;
27 debug("onmessage() was called. (message = \"" + message + "\")");
28 shouldBeEqualToString("message", "PASS");
31 ws.onclose = function(event)
33 closeEvent = event;
34 shouldBeTrue("closeEvent.wasClean");
35 finishJSTest();
38 </script>
39 </body>
40 </html>