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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/webusb/resources/usb-helpers.js

Issue 2789723003: Migrate WebUSB LayoutTests into external/wpt (Closed)
Patch Set: Rebased Created 3 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/external/wpt/webusb/resources/usb-helpers.js
diff --git a/third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js b/third_party/WebKit/LayoutTests/external/wpt/webusb/resources/usb-helpers.js
similarity index 82%
rename from third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js
rename to third_party/WebKit/LayoutTests/external/wpt/webusb/resources/usb-helpers.js
index 22e5a65d657b25440d6e1a14645d1cf05a06097f..454f9090d2ce884417d410aa6b87be9c462f1e93 100644
--- a/third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js
+++ b/third_party/WebKit/LayoutTests/external/wpt/webusb/resources/usb-helpers.js
@@ -74,24 +74,17 @@ function assertDeviceInfoEquals(usbDevice, deviceInit) {
}
}
-// TODO(reillyg): Remove when jyasskin upstreams this to testharness.js:
-// https://crbug.com/509058.
-function callWithKeyDown(functionCalledOnKeyPress) {
+function callWithTrustedClick(callback) {
return new Promise(resolve => {
- function onKeyPress() {
- document.removeEventListener('keypress', onKeyPress, false);
- resolve(functionCalledOnKeyPress());
- }
- document.addEventListener('keypress', onKeyPress, false);
-
- eventSender.keyDown(' ', []);
- });
-}
-
-function runGarbageCollection() {
- // Run gc() as a promise.
- return new Promise((resolve, reject) => {
- GCController.collect();
- setTimeout(resolve, 0);
+ let button = document.createElement('button');
+ button.textContent = 'click to continue test';
+ button.style.display = 'block';
+ button.style.fontSize = '20px';
+ button.style.padding = '10px';
+ button.onclick = () => {
+ resolve(callback());
+ document.body.removeChild(button);
+ };
+ document.body.appendChild(button);
});
}

Powered by Google App Engine
This is Rietveld 408576698