OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 description("Tests RTCDataChannel."); | 8 description("Tests RTCDataChannel."); |
9 | 9 |
10 var pc = null; | 10 var pc = null; |
11 var dc = null; | 11 var dc = null; |
12 var data; | 12 var data; |
13 var array; | 13 var array; |
14 | 14 |
15 function dc_onclose() { | 15 function dc_onclose() { |
16 testPassed("dc_onclose was called"); | 16 testPassed("dc_onclose was called"); |
17 shouldBe("dc.readyState", "'closed'"); | 17 shouldBe("dc.readyState", "'closed'"); |
18 | 18 |
19 finishJSTest(); | 19 finishJSTest(); |
20 } | 20 } |
21 | 21 |
22 function dc_onmessage_sharedarraybuffer_view() { | |
23 if (window.SharedArrayBuffer) { | |
24 shouldThrow("dc.send(new Uint8Array(new SharedArrayBuffer(16)));"); | |
25 } | |
26 | |
27 dc.onclose = dc_onclose; | |
28 dc.close(); | |
29 } | |
30 | |
31 function dc_onmessage_dataview(e) { | 22 function dc_onmessage_dataview(e) { |
32 testPassed("dc_onmessage_dataview was called"); | 23 testPassed("dc_onmessage_dataview was called"); |
33 data = e.data; | 24 data = e.data; |
34 shouldBe("data.byteLength", "10"); | 25 shouldBe("data.byteLength", "10"); |
35 array = new Int8Array(e.data); | 26 array = new Int8Array(e.data); |
36 shouldBe("array[0]", "1"); | 27 shouldBe("array[0]", "1"); |
37 shouldBe("array[9]", "10"); | 28 shouldBe("array[9]", "10"); |
38 | 29 |
39 dc_onmessage_sharedarraybuffer_view(); | 30 dc.onclose = dc_onclose; |
| 31 dc.close(); |
40 } | 32 } |
41 | 33 |
42 function dc_onmessage_arraybuffer(e) { | 34 function dc_onmessage_arraybuffer(e) { |
43 testPassed("dc_onmessage_arraybuffer was called"); | 35 testPassed("dc_onmessage_arraybuffer was called"); |
44 data = e.data; | 36 data = e.data; |
45 shouldBe("data.byteLength", "2"); | 37 shouldBe("data.byteLength", "2"); |
46 array = new Int8Array(e.data); | 38 array = new Int8Array(e.data); |
47 shouldBe("array[0]", "17"); | 39 shouldBe("array[0]", "17"); |
48 shouldBe("array[1]", "19"); | 40 shouldBe("array[1]", "19"); |
49 | 41 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 104 |
113 pc = new RTCPeerConnection(); | 105 pc = new RTCPeerConnection(); |
114 pc.oniceconnectionstatechange = pc_onicechange; | 106 pc.oniceconnectionstatechange = pc_onicechange; |
115 pc.ondatachannel = pc_ondatachannel; | 107 pc.ondatachannel = pc_ondatachannel; |
116 | 108 |
117 window.jsTestIsAsync = true; | 109 window.jsTestIsAsync = true; |
118 window.successfullyParsed = true; | 110 window.successfullyParsed = true; |
119 </script> | 111 </script> |
120 </body> | 112 </body> |
121 </html> | 113 </html> |
OLD | NEW |