tizen beta release
[framework/web/webkit-efl.git] / LayoutTests / http / tests / websocket / tests / hybi / null-character.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 WebSocket transfer null character");
11
12 window.jsTestIsAsync = true;
13 if (window.layoutTestController)
14     layoutTestController.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 0);
15
16 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hybi/echo");
17 // \xff in string would be \xc3\xbf on websocket connection (UTF-8)
18 var expectedMessage = "Should Not\xff\0Split";
19
20 ws.onopen = function()
21 {
22     debug("WebSocket open");
23     ws.send(expectedMessage);
24 };
25
26 var msg;
27 ws.onmessage = function(messageEvent)
28 {
29     msg = messageEvent.data;
30     debug("msg should not be split by frame char \\xff\\0");
31     shouldBe("msg", "expectedMessage");
32     ws.close();
33 };
34
35 ws.onclose = function()
36 {
37     debug("WebSocket closed");
38     finishJSTest();
39 };
40
41 </script>
42 <script src="../../../../js-test-resources/js-test-post.js"></script>
43 </body>
44 </html>