1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"/js-test-resources/js-test.js"></script>
7 <div id=
"description"></div>
8 <div id=
"console"></div>
9 <script type=
"text/javascript">
10 description("WebSocket unicode message test");
12 window
.jsTestIsAsync
= true;
16 clearTimeout(timeoutID
);
20 var ws
= new WebSocket("ws://localhost:8880/unicode");
23 var UNICODE_HELLO
= "\u3053\u3093\u306b\u3061\u306f";
24 // Goodbye in Japanese
25 var UNICODE_GOODBYE
= "\u3055\u3088\u3046\u306a\u3089";
27 // data needs to be global to be accessbile from shouldBe().
30 ws
.onopen = function()
33 debug("Send UNICODE_HELLO.");
34 ws
.send(UNICODE_HELLO
);
37 ws
.onmessage = function(messageEvent
)
39 // The server should send back Goodbye if it receives Hello.
40 data
= messageEvent
.data
;
41 shouldBe("data", "UNICODE_GOODBYE");
44 ws
.onclose = function()
50 function timeOutCallback()
52 testFailed("Timed out in state: " + ws
.readyState
);
56 var timeoutID
= setTimeout(timeOutCallback
, 3000);