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

Side by Side Diff: third_party/WebKit/LayoutTests/usb/usbDevice.html

Issue 1850023002: Consume Mojo services directly in Blink's WebUSB implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't do assignments in if statements. Created 4 years, 8 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 | « device/usb/usb.gyp ('k') | third_party/WebKit/Source/modules/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/mojo-helpers.js"></script> 4 <script src="../resources/mojo-helpers.js"></script>
5 <script src="resources/fake-devices.js"></script> 5 <script src="resources/fake-devices.js"></script>
6 <script src="resources/usb-helpers.js"></script> 6 <script src="resources/usb-helpers.js"></script>
7 <script> 7 <script>
8 'use strict'; 8 'use strict';
9 9
10 function assertRejectsWithNotFoundError(promise) { 10 function assertRejectsWithNotFoundError(promise) {
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 .then(() => Promise.all([ 237 .then(() => Promise.all([
238 assertRejectsWithError( 238 assertRejectsWithError(
239 device.claimInterface(2), 'NotFoundError', message), 239 device.claimInterface(2), 'NotFoundError', message),
240 assertRejectsWithError( 240 assertRejectsWithError(
241 device.releaseInterface(2), 'NotFoundError', message), 241 device.releaseInterface(2), 'NotFoundError', message),
242 ])) 242 ]))
243 .then(() => device.close()); 243 .then(() => device.close());
244 }); 244 });
245 }, 'a non-existent interface cannot be claimed or released'); 245 }, 'a non-existent interface cannot be claimed or released');
246 246
247
248 usb_test(usb => { 247 usb_test(usb => {
249 usb.mockDeviceManager.addMockDevice(usb.fakeDevices[0]); 248 usb.mockDeviceManager.addMockDevice(usb.fakeDevices[0]);
250 return navigator.usb.getDevices().then(devices => { 249 return navigator.usb.getDevices().then(devices => {
251 assert_equals(1, devices.length); 250 assert_equals(1, devices.length);
252 var device = devices[0]; 251 var device = devices[0];
253 return device.open() 252 return device.open()
254 .then(() => device.selectConfiguration(1)) 253 .then(() => device.selectConfiguration(1))
255 .then(() => { 254 .then(() => {
256 usb.mockDeviceManager.removeMockDevice(usb.fakeDevices[0]); 255 usb.mockDeviceManager.removeMockDevice(usb.fakeDevices[0]);
257 return assertRejectsWithNotFoundError(device.claimInterface(0)); 256 return assertRejectsWithNotFoundError(device.claimInterface(0));
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 return navigator.usb.getDevices().then(devices => { 745 return navigator.usb.getDevices().then(devices => {
747 assert_equals(1, devices.length); 746 assert_equals(1, devices.length);
748 let device = devices[0]; 747 let device = devices[0];
749 return device.open().then(() => { 748 return device.open().then(() => {
750 usb.mockDeviceManager.removeMockDevice(usb.fakeDevices[0]); 749 usb.mockDeviceManager.removeMockDevice(usb.fakeDevices[0]);
751 return assertRejectsWithNotFoundError(device.reset()); 750 return assertRejectsWithNotFoundError(device.reset());
752 }); 751 });
753 }); 752 });
754 }, 'resetDevice rejects when called on a disconnected device'); 753 }, 'resetDevice rejects when called on a disconnected device');
755 </script> 754 </script>
OLDNEW
« no previous file with comments | « device/usb/usb.gyp ('k') | third_party/WebKit/Source/modules/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698