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

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

Issue 1754543003: Add WebUSB layout tests for device disconnection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses rockot@'s nits. 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
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 4a2ca697eca0d95114dfbdaea326d1210136fe56..51aa29b38ede3743eb941cffb9e3c3549ddb8cc1 100644
--- a/third_party/WebKit/LayoutTests/usb/usb.html
+++ b/third_party/WebKit/LayoutTests/usb/usb.html
@@ -17,13 +17,22 @@ usb_test(usb => {
}, 'getDevices returns devices exposed by the DeviceManager service.');
usb_test(usb => {
+ return navigator.usb.requestDevice({ filters: [] })
+ .then(device => {
+ assert_unreachable('requestDevice should reject without a user gesture');
+ })
+ .catch(error => {
+ assert_equals(error.code, DOMException.SECURITY_ERR);
+ });
+}, 'requestDevice rejects when called without a user gesture');
+
+usb_test(usb => {
return callWithKeyDown(() => navigator.usb.requestDevice({ filters: [] })
.then(device => {
assert_unreachable('requestDevice should reject when no device selected');
})
.catch(error => {
assert_equals(error.code, DOMException.NOT_FOUND_ERR);
- return Promise.resolve();
})
);
}, 'requestDevice rejects when no device is chosen');
« no previous file with comments | « third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js ('k') | third_party/WebKit/LayoutTests/usb/usbDevice.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698