OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../resources/testharness.js"></script> | 2 <script src="/resources/testharness.js"></script> |
3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="/resources/testharnessreport.js"></script> |
4 <script src="resources/fake-devices.js"></script> | 4 <script src="resources/fake-devices.js"></script> |
5 <script src="resources/usb-helpers.js"></script> | 5 <script src="resources/usb-helpers.js"></script> |
6 <script src="resources/webusb-test.js"></script> | |
7 <script> | 6 <script> |
8 'use strict'; | 7 'use strict'; |
9 | 8 |
10 usb_test(() => { | 9 usb_test(() => { |
11 return getFakeDevice().then(({ device }) => { | 10 return getFakeDevice().then(({ device }) => { |
12 let evt = new USBConnectionEvent('connect', { device: device }); | 11 let evt = new USBConnectionEvent('connect', { device: device }); |
13 assert_equals(evt.type, 'connect'); | 12 assert_equals(evt.type, 'connect'); |
14 assert_equals(evt.device, device); | 13 assert_equals(evt.device, device); |
15 }); | 14 }); |
16 }, 'Can construct a USBConnectionEvent with a device'); | 15 }, 'Can construct a USBConnectionEvent with a device'); |
17 | 16 |
18 test(t => { | 17 test(t => { |
19 assert_throws(TypeError(), () => | 18 assert_throws(TypeError(), () => |
20 new USBConnectionEvent('connect', { device: null })); | 19 new USBConnectionEvent('connect', { device: null })); |
21 assert_throws(TypeError(), () => new USBConnectionEvent('connect', {})); | 20 assert_throws(TypeError(), () => new USBConnectionEvent('connect', {})); |
22 }, 'Cannot construct a USBConnectionEvent without a device'); | 21 }, 'Cannot construct a USBConnectionEvent without a device'); |
23 </script> | 22 </script> |
OLD | NEW |