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

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

Issue 2789723003: Migrate WebUSB LayoutTests into external/wpt (Closed)
Patch Set: Add README.md and more comments explaining the polyfill Created 3 years, 6 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 | « third_party/WebKit/LayoutTests/usb/usbDevice.html ('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/usbDevice-iframe.html
diff --git a/third_party/WebKit/LayoutTests/usb/usbDevice-iframe.html b/third_party/WebKit/LayoutTests/usb/usbDevice-iframe.html
index d2c4aabbd067dec2d042485ffbfd943a0ab84150..98256f127230dadcfc9c1ba9e30ad9edbeed61c9 100644
--- a/third_party/WebKit/LayoutTests/usb/usbDevice-iframe.html
+++ b/third_party/WebKit/LayoutTests/usb/usbDevice-iframe.html
@@ -1,58 +1,16 @@
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
-<script src="resources/fake-devices.js"></script>
-<script src="resources/usb-helpers.js"></script>
-<script src="resources/webusb-test.js"></script>
+<script src="../external/wpt/webusb/resources/fake-devices.js"></script>
+<script src="../external/wpt/resources/chromium/mojo_bindings.js"></script>
+<script src="../external/wpt/resources/chromium/device.mojom.js"></script>
+<script src="../external/wpt/resources/chromium/device_manager.mojom.js"></script>
+<script src="../external/wpt/resources/chromium/chooser_service.mojom.js"></script>
+<script src="../external/wpt/resources/chromium/webusb-test.js"></script>
<body>
<script>
'use strict';
-function runIframeDisconnectTest(onDeviceConnected) {
- return navigator.usb.test.initialize().then(() => {
- return new Promise((resolve, reject) => {
- let opened = false;
-
- let iframe = document.createElement('iframe');
- iframe.src = 'resources/open-in-iframe.html';
- iframe.onload = () => {
- navigator.usb.test.attachToWindow(iframe.contentWindow).then(() => {
- iframe.contentWindow.postMessage('Ready', '*');
- });
- };
-
- window.onmessage = messageEvent => {
- if (messageEvent.data == 'Ready') {
- let fakeDevice = navigator.usb.test.addFakeDevice(fakeDeviceInit);
- fakeDevice.onclose = () => {
- assert_true(opened);
- resolve();
- };
- } else if (messageEvent.data == 'Success') {
- opened = true;
- onDeviceConnected(iframe);
- } else {
- reject(messageEvent.data);
- }
- };
-
- document.body.appendChild(iframe);
- });
- });
-}
-
-promise_test(() => {
- return runIframeDisconnectTest(iframe => {
- document.body.removeChild(iframe);
- });
-}, 'detaching iframe disconnects device.');
-
-promise_test(() => {
- return runIframeDisconnectTest(iframe => {
- iframe.src = 'about:blank';
- });
-}, 'navigating iframe disconnects device.');
-
promise_test(() => {
return navigator.usb.test.initialize().then(() => {
return new Promise((resolve, reject) => {
@@ -60,7 +18,7 @@ promise_test(() => {
let fakeDeviceGuid = null;
let iframe = document.createElement('iframe');
- iframe.src = 'resources/open-in-iframe.html';
+ iframe.src = '../external/wpt/webusb/resources/open-in-iframe.html';
iframe.onload = () => {
navigator.usb.test.attachToWindow(iframe.contentWindow).then(() => {
iframe.contentWindow.postMessage('Ready', '*');
@@ -70,10 +28,9 @@ promise_test(() => {
window.onmessage = messageEvent => {
if (messageEvent.data == 'Ready') {
document.body.removeChild(iframe);
- runGarbageCollection().then(() => {
- navigator.usb.test.addFakeDevice(fakeDeviceInit);
- resolve();
- });
+ GCController.collect();
+ navigator.usb.test.addFakeDevice(fakeDeviceInit);
+ resolve();
} else {
reject(messageEvent.data);
}
« no previous file with comments | « third_party/WebKit/LayoutTests/usb/usbDevice.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698