JS Test Harness: Remove successfullyParsed from more tests
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hixie76 / send-object.html
1 <!DOCTYPE html>
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>
10 description("WebSocket: send(object) should be interpreted as send(object.toString()).");
11
12 window.jsTestIsAsync = true;
13
14 function createEmptyBlob()
15 {
16     var builder = new WebKitBlobBuilder();
17     return builder.getBlob();
18 }
19
20 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hixie76/echo");
21
22 var closeEvent;
23 var receivedMessages = [];
24 var expectedMessages = ["[object Object]", "[object ArrayBuffer]", "[object Blob]", "Goodbye"];
25
26 ws.onopen = function()
27 {
28     ws.send({});
29     ws.send(new ArrayBuffer());
30     ws.send(createEmptyBlob());
31     ws.send("Goodbye");
32 };
33
34 ws.onmessage = function(event)
35 {
36     receivedMessages.push(event.data);
37 };
38
39 ws.onclose = function(event)
40 {
41     closeEvent = event;
42     shouldBeTrue("closeEvent.wasClean");
43
44     shouldEvaluateTo("receivedMessages.length", expectedMessages.length);
45     for (var i = 0; i < expectedMessages.length; ++i)
46         shouldBeEqualToString("receivedMessages[" + i + "]", expectedMessages[i]);
47     finishJSTest();
48 };
49
50 </script>
51 <script src="../../../../js-test-resources/js-test-post.js"></script>
52 </body>
53 </html>