| 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 |
| 22 function dc_onmessage_dataview(e) { | 31 function dc_onmessage_dataview(e) { |
| 23 testPassed("dc_onmessage_dataview was called"); | 32 testPassed("dc_onmessage_dataview was called"); |
| 24 data = e.data; | 33 data = e.data; |
| 25 shouldBe("data.byteLength", "10"); | 34 shouldBe("data.byteLength", "10"); |
| 26 array = new Int8Array(e.data); | 35 array = new Int8Array(e.data); |
| 27 shouldBe("array[0]", "1"); | 36 shouldBe("array[0]", "1"); |
| 28 shouldBe("array[9]", "10"); | 37 shouldBe("array[9]", "10"); |
| 29 | 38 |
| 30 dc.onclose = dc_onclose; | 39 dc_onmessage_sharedarraybuffer_view(); |
| 31 dc.close(); | |
| 32 } | 40 } |
| 33 | 41 |
| 34 function dc_onmessage_arraybuffer(e) { | 42 function dc_onmessage_arraybuffer(e) { |
| 35 testPassed("dc_onmessage_arraybuffer was called"); | 43 testPassed("dc_onmessage_arraybuffer was called"); |
| 36 data = e.data; | 44 data = e.data; |
| 37 shouldBe("data.byteLength", "2"); | 45 shouldBe("data.byteLength", "2"); |
| 38 array = new Int8Array(e.data); | 46 array = new Int8Array(e.data); |
| 39 shouldBe("array[0]", "17"); | 47 shouldBe("array[0]", "17"); |
| 40 shouldBe("array[1]", "19"); | 48 shouldBe("array[1]", "19"); |
| 41 | 49 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 112 |
| 105 pc = new RTCPeerConnection(); | 113 pc = new RTCPeerConnection(); |
| 106 pc.oniceconnectionstatechange = pc_onicechange; | 114 pc.oniceconnectionstatechange = pc_onicechange; |
| 107 pc.ondatachannel = pc_ondatachannel; | 115 pc.ondatachannel = pc_ondatachannel; |
| 108 | 116 |
| 109 window.jsTestIsAsync = true; | 117 window.jsTestIsAsync = true; |
| 110 window.successfullyParsed = true; | 118 window.successfullyParsed = true; |
| 111 </script> | 119 </script> |
| 112 </body> | 120 </body> |
| 113 </html> | 121 </html> |
| OLD | NEW |