Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / websocket / pong.html
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.");
11
12 window.jsTestIsAsync = true;
13
14 var url = "ws://localhost:8880/pong?payload=Hello,%20World%21";
15 var ws = new WebSocket(url);
16 var closeEvent;
17 var message;
18
19 ws.onopen = function()
20 {
21     debug("onopen() was called.");
22 };
23
24 ws.onmessage = function(event)
25 {
26     message = event.data;
27     debug("onmessage() was called. (message = \"" + message + "\")");
28     shouldBeEqualToString("message", "PASS");
29 };
30
31 ws.onclose = function(event)
32 {
33     closeEvent = event;
34     shouldBeTrue("closeEvent.wasClean");
35     finishJSTest();
36 };
37
38 </script>
39 </body>
40 </html>