Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/webusb/usbConnectionEvent.https.html

Issue 2789723003: Migrate WebUSB LayoutTests into external/wpt (Closed)
Patch Set: Upstream tests that will work in stable Chrome Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 try { 18 try {
foolip 2017/06/21 08:23:30 Can be reduced to `assert_throws(new TypeError, ()
Reilly Grant (use Gerrit) 2017/06/21 21:35:16 Done in https://chromium-review.googlesource.com/c
20 new USBConnectionEvent('connect', { device: null }); 19 new USBConnectionEvent('connect', { device: null });
21 assert_unreached('expected TypeError'); 20 assert_unreached('expected TypeError');
22 } catch (err) { 21 } catch (err) {
23 assert_true(err instanceof TypeError); 22 assert_true(err instanceof TypeError);
24 } 23 }
25 24
26 try { 25 try {
27 new USBConnectionEvent('connect', {}) 26 new USBConnectionEvent('connect', {})
28 assert_unreached('expected TypeError'); 27 assert_unreached('expected TypeError');
29 } catch (err) { 28 } catch (err) {
30 assert_true(err instanceof TypeError); 29 assert_true(err instanceof TypeError);
31 } 30 }
32 }, 'Cannot construct a USBConnectionEvent without a device'); 31 }, 'Cannot construct a USBConnectionEvent without a device');
33 </script> 32 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698