OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <meta charset="utf-8"> | |
3 <title>RTCDataChannelEvent constructor</title> | |
4 <script src="../../resources/testharness.js"></script> | |
5 <script src="../../resources/testharnessreport.js"></script> | |
6 <script> | |
7 test(function() { | |
8 assert_equals(RTCDataChannelEvent.length, 2); | |
9 assert_throws( | |
10 new TypeError(), | |
11 function() { new RTCDataChannelEvent('type'); } | |
12 ); | |
13 }, 'RTCDataChannelEvent constructor without a required argument.'); | |
14 | |
15 test(function() { | |
16 assert_throws( | |
17 new TypeError(), | |
18 function() { new RTCDataChannelEvent('type', { channel: null }); } | |
19 ); | |
20 }, 'RTCDataChannelEvent constructor with channel passed as "null".'); | |
21 | |
22 test(function() { | |
23 assert_throws( | |
24 new TypeError(), | |
25 function() { new RTCDataChannelEvent('type', { channel: undefined }); } | |
26 ); | |
27 }, 'RTCDataChannelEvent constructor with a channel passed as "undefined".'); | |
28 | |
29 test(function() { | |
30 var pc = new RTCPeerConnection(); | |
31 var c = pc.createDataChannel(''); | |
32 var e = new RTCDataChannelEvent('type', { channel: c }); | |
33 assert_true(e instanceof RTCDataChannelEvent); | |
34 assert_equals(e.channel, c); | |
35 }, 'RTCDataChannelEvent constructor with full arguments.'); | |
36 </script> | |
OLD | NEW |