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

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

Issue 1755683004: Skip attempting to bind a DevicePtr for a removed device. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « content/renderer/usb/web_usb_device_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/usb/usb.html
diff --git a/third_party/WebKit/LayoutTests/usb/usb.html b/third_party/WebKit/LayoutTests/usb/usb.html
index 51aa29b38ede3743eb941cffb9e3c3549ddb8cc1..857cb30d773af39f774c5297584914c06f55d614 100644
--- a/third_party/WebKit/LayoutTests/usb/usb.html
+++ b/third_party/WebKit/LayoutTests/usb/usb.html
@@ -49,25 +49,35 @@ usb_test(usb => {
usb_test(usb => {
let promise = new Promise((resolve, reject) => {
navigator.usb.addEventListener('connect', e => {
- usb.assertDeviceInfoEquals(e.device, usb.fakeDevices[0]);
- resolve();
+ assert_true(e instanceof USBConnectionEvent);
+ resolve(e.device);
});
});
usb.mockDeviceManager.addMockDevice(usb.fakeDevices[0]);
- return promise;
+ return promise.then(device => {
+ usb.assertDeviceInfoEquals(device, usb.fakeDevices[0]);
+ return device.open().then(() => device.close());
+ });
}, 'onconnect event is trigged by adding a device');
usb_test(usb => {
let promise = new Promise((resolve, reject) => {
navigator.usb.addEventListener('disconnect', e => {
- usb.assertDeviceInfoEquals(e.device, usb.fakeDevices[0]);
- resolve();
+ assert_true(e instanceof USBConnectionEvent);
+ resolve(e.device);
});
});
usb.mockDeviceManager.addMockDevice(usb.fakeDevices[0]);
usb.mockDeviceManager.removeMockDevice(usb.fakeDevices[0]);
- return promise;
+ return promise.then(device => {
+ usb.assertDeviceInfoEquals(device, usb.fakeDevices[0]);
+ return device.open().then(() => {
+ assert_unreachable('should not be able to open a disconnected device');
+ }, error => {
+ assert_equals(error.code, DOMException.NOT_FOUND_ERR);
+ });
+ });
}, 'ondisconnect event is triggered by removing a device');
</script>
« no previous file with comments | « content/renderer/usb/web_usb_device_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698