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

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

Issue 1806163002: Track USB alternate interface state in Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blink_interface_state
Patch Set: Fixed typo and 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 9a98de34f3796f2c7b1e431c7537003b3e02558c..3fefee2ca5a03950503373d17a024e25dae1b85f 100644
--- a/third_party/WebKit/LayoutTests/usb/usbDevice.html
+++ b/third_party/WebKit/LayoutTests/usb/usbDevice.html
@@ -125,7 +125,7 @@ usb_test(usb => {
assertRejectsWithNotOpenError(device.selectConfiguration(1)),
assertRejectsWithNotOpenError(device.claimInterface(0)),
assertRejectsWithNotOpenError(device.releaseInterface(0)),
- assertRejectsWithNotOpenError(device.setInterface(0, 1)),
+ assertRejectsWithNotOpenError(device.selectAlternateInterface(0, 1)),
assertRejectsWithNotOpenError(device.controlTransferIn({
requestType: 'vendor',
recipient: 'device',
@@ -195,7 +195,7 @@ usb_test(usb => {
return device.open().then(() => Promise.all([
assertRejectsWithNotConfiguredError(device.claimInterface(0)),
assertRejectsWithNotConfiguredError(device.releaseInterface(0)),
- assertRejectsWithNotConfiguredError(device.setInterface(0, 1)),
+ assertRejectsWithNotConfiguredError(device.selectAlternateInterface(0, 1)),
assertRejectsWithNotConfiguredError(device.controlTransferIn({
requestType: 'vendor',
recipient: 'device',
@@ -292,7 +292,7 @@ usb_test(usb => {
return device.open()
.then(() => device.selectConfiguration(2))
.then(() => device.claimInterface(0))
- .then(() => device.setInterface(0, 1))
+ .then(() => device.selectAlternateInterface(0, 1))
.then(() => device.close());
});
}, 'can select an alternate interface');
@@ -301,16 +301,32 @@ usb_test(usb => {
usb.mockDeviceManager.addMockDevice(usb.fakeDevices[0]);
return navigator.usb.getDevices().then(devices => {
assert_equals(1, devices.length);
+ let device = devices[0];
+ return device.open()
+ .then(() => device.selectConfiguration(2))
+ .then(() => device.claimInterface(0))
+ .then(() => assertRejectsWithError(
+ device.selectAlternateInterface(0, 2), 'NotFoundError',
+ 'The alternate setting provided is not supported by the device in ' +
+ 'its current configuration.'))
+ .then(() => device.close());
+ });
+}, 'cannot select a non-existent alternate interface');
+
+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(2))
.then(() => device.claimInterface(0))
.then(() => {
usb.mockDeviceManager.removeMockDevice(usb.fakeDevices[0]);
- return assertRejectsWithNotFoundError(device.setInterface(0, 1));
+ return assertRejectsWithNotFoundError(device.selectAlternateInterface(0, 1));
});
});
-}, 'setInterface rejects when called on a disconnected device');
+}, 'selectAlternateInterface rejects when called on a disconnected device');
usb_test(usb => {
usb.mockDeviceManager.addMockDevice(usb.fakeDevices[0]);
@@ -535,7 +551,7 @@ usb_test(usb => {
return device.open()
.then(() => device.selectConfiguration(2))
.then(() => device.claimInterface(0))
- .then(() => device.setInterface(0, 1))
+ .then(() => device.selectAlternateInterface(0, 1))
.then(() => device.isochronousTransferIn(
1, [64, 64, 64, 64, 64, 64, 64, 64]))
.then(result => {
@@ -568,7 +584,7 @@ usb_test(usb => {
return device.open()
.then(() => device.selectConfiguration(2))
.then(() => device.claimInterface(0))
- .then(() => device.setInterface(0, 1))
+ .then(() => device.selectAlternateInterface(0, 1))
.then(() => {
usb.mockDeviceManager.removeMockDevice(usb.fakeDevices[0]);
return assertRejectsWithNotFoundError(device.isochronousTransferIn(
@@ -585,7 +601,7 @@ usb_test(usb => {
return device.open()
.then(() => device.selectConfiguration(2))
.then(() => device.claimInterface(0))
- .then(() => device.setInterface(0, 1))
+ .then(() => device.selectAlternateInterface(0, 1))
.then(() => {
let data = new DataView(new ArrayBuffer(64 * 8));
for (let i = 0; i < 8; ++i) {
@@ -618,7 +634,7 @@ usb_test(usb => {
return device.open()
.then(() => device.selectConfiguration(2))
.then(() => device.claimInterface(0))
- .then(() => device.setInterface(0, 1))
+ .then(() => device.selectAlternateInterface(0, 1))
.then(() => {
let data = new DataView(new ArrayBuffer(64 * 8));
for (let i = 0; i < 8; ++i) {
« 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