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

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

Issue 1912223002: Make new WebUSB implementation more resilient to garbage collection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased again. 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 side-by-side diff with in-line comments
Download patch
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 5ea54fbfcb3faf7471a5921cd4e7bba6052abaad..09ccd7ef5a419646ad0c28abb6c904f59cd874f0 100644
--- a/third_party/WebKit/LayoutTests/usb/usbDevice.html
+++ b/third_party/WebKit/LayoutTests/usb/usbDevice.html
@@ -35,6 +35,17 @@ usb_test(usb => {
usb.mockDeviceManager.addMockDevice(usb.fakeDevices[0]);
return navigator.usb.getDevices().then(devices => {
assert_equals(1, devices.length);
+ let promise = devices[0].open();
+ usb.mockDeviceManager.removeMockDevice(usb.fakeDevices[0]);
+ return assertRejectsWithNotFoundError(promise)
+ .then(() => runGarbageCollection());
+ });
+}, 'open rejects when device disconnected during call');
+
+usb_test(usb => {
+ usb.mockDeviceManager.addMockDevice(usb.fakeDevices[0]);
+ return navigator.usb.getDevices().then(devices => {
+ assert_equals(1, devices.length);
let device = devices[0];
assert_false(device.opened);
return device.open().then(() => {
@@ -43,7 +54,7 @@ usb_test(usb => {
assert_false(device.opened);
});
});
- });
+ }).then(() => runGarbageCollection());
}, 'a device can be opened and closed');
usb_test(usb => {
« no previous file with comments | « third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js ('k') | third_party/WebKit/Source/modules/webusb/USB.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698