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