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

Unified Diff: third_party/WebKit/LayoutTests/usb/usbDevice.html

Issue 1814603002: Track USB device interface claim state in Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/usb/usbDevice.html
diff --git a/third_party/WebKit/LayoutTests/usb/usbDevice.html b/third_party/WebKit/LayoutTests/usb/usbDevice.html
index d4744e802834bd4e3349f867a0991ef39e92b088..9a98de34f3796f2c7b1e431c7537003b3e02558c 100644
--- a/third_party/WebKit/LayoutTests/usb/usbDevice.html
+++ b/third_party/WebKit/LayoutTests/usb/usbDevice.html
@@ -140,7 +140,7 @@ usb_test(usb => {
value: 0x1234,
index: 0x5678
}, new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]))),
- assertRejectsWithNotOpenError(device.clearHalt(1)),
+ assertRejectsWithNotOpenError(device.clearHalt('in', 1)),
assertRejectsWithNotOpenError(device.transferIn(1, 8)),
assertRejectsWithNotOpenError(
device.transferOut(1, new ArrayBuffer(8))),
@@ -210,7 +210,7 @@ usb_test(usb => {
value: 0x1234,
index: 0x5678
}, new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]))),
- assertRejectsWithNotConfiguredError(device.clearHalt(1)),
+ assertRejectsWithNotConfiguredError(device.clearHalt('in', 1)),
assertRejectsWithNotConfiguredError(device.transferIn(1, 8)),
assertRejectsWithNotConfiguredError(
device.transferOut(1, new ArrayBuffer(8))),
@@ -239,6 +239,26 @@ usb_test(usb => {
usb.mockDeviceManager.addMockDevice(usb.fakeDevices[0]);
return navigator.usb.getDevices().then(devices => {
assert_equals(1, devices.length);
+ let device = devices[0];
+ const message = 'The interface number provided is not supported by the ' +
+ 'device in its current configuration.';
+ return device.open()
+ .then(() => device.selectConfiguration(1))
+ .then(() => Promise.all([
+ assertRejectsWithError(
+ device.claimInterface(2), 'NotFoundError', message),
+ assertRejectsWithError(
+ device.releaseInterface(2), 'NotFoundError', message),
+ ]))
+ .then(() => device.close());
+ });
+}, 'a non-existent interface cannot be claimed or released');
+
+
+usb_test(usb => {
+ usb.mockDeviceManager.addMockDevice(usb.fakeDevices[0]);
+ return navigator.usb.getDevices().then(devices => {
+ assert_equals(1, devices.length);
var device = devices[0];
return device.open()
.then(() => device.selectConfiguration(1))
@@ -390,7 +410,7 @@ usb_test(usb => {
return device.open()
.then(() => device.selectConfiguration(1))
.then(() => device.claimInterface(0))
- .then(() => device.clearHalt(1))
+ .then(() => device.clearHalt('in', 1))
.then(() => device.close());
});
}, 'can clear a halt condition');
@@ -405,7 +425,7 @@ usb_test(usb => {
.then(() => device.claimInterface(0))
.then(() => {
usb.mockDeviceManager.removeMockDevice(usb.fakeDevices[0]);
- return assertRejectsWithNotFoundError(device.clearHalt(1));
+ return assertRejectsWithNotFoundError(device.clearHalt('in', 1));
});
});
}, 'clearHalt rejects when called on a disconnected device');
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698