| <!doctype html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <title>Testing RTCDataChannelEvent</title> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| </head> |
| <body> |
| <script> |
| test(() => { |
| var pc = new RTCPeerConnection(); |
| var channel = pc.createDataChannel("test"); |
| |
| assert_throws_js(TypeError, () => new RTCDataChannelEvent()); |
| assert_throws_js(TypeError, () => new RTCDataChannelEvent("test")); |
| assert_throws_js(TypeError, () => new RTCDataChannelEvent("test", undefined)); |
| assert_throws_js(TypeError, () => new RTCDataChannelEvent("test", { channel: 1 })); |
| assert_throws_js(TypeError, () => new RTCDataChannelEvent(undefined, { channel: 1 })); |
| |
| var event = new RTCDataChannelEvent("test", { channel: channel }); |
| assert_equals(event.channel, channel, "channel passed in constructor should be used"); |
| assert_equals(event.type, "test"); |
| assert_equals(event.isTrusted, false, "trusted"); |
| assert_equals(event.bubbles, false, "bubble"); |
| assert_equals(event.cancelable, false, "cancelable"); |
| |
| }, "Testing data channel event constructor"); |
| </script> |
| </body> |
| </html> |