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

Side by Side Diff: third_party/WebKit/LayoutTests/usb/usb-connection-event.html

Issue 2348703003: Update USBConnectionEvent.idl to match the spec. (Closed)
Patch Set: Add tests. Created 4 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webusb/USBConnectionEvent.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <script src="../resources/mojo-helpers.js"></script>
5 <script src="resources/fake-devices.js"></script>
6 <script src="resources/usb-helpers.js"></script>
7 <script>
8 'use strict';
9
10 usb_test(usb => {
11 usb.mockDeviceManager.addMockDevice(usb.fakeDevices[0]);
12
13 return navigator.usb.getDevices().then(devices => {
14 assert_equals(devices.length, 1);
15 let evt = new USBConnectionEvent('connect', { device: devices[0] });
16 assert_equals(evt.type, 'connect');
17 assert_equals(evt.device, devices[0]);
18 });
19 }, 'Can construct a USBConnectionEvent with a device');
20
21 test(t => {
22 try {
23 new USBConnectionEvent('connect', { device: null });
Jeffrey Yasskin 2016/09/27 19:54:57 FWIW, I think you can use promise_rejects() for th
Reilly Grant (use Gerrit) 2016/09/28 02:07:24 There is assert_throws() but it only accepts DOMEx
Jeffrey Yasskin 2016/09/28 20:21:52 It turns out that TypeError() works, while 'TypeEr
24 assert_unreached('expected TypeError');
25 } catch (err) {
26 assert_true(err instanceof TypeError);
27 }
28
29 try {
30 new USBConnectionEvent('connect', {})
31 assert_unreached('expected TypeError');
32 } catch (err) {
33 assert_true(err instanceof TypeError);
34 }
35 }, 'Cannot construct a USBConnectionEvent without a device');
36 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webusb/USBConnectionEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698