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

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

Issue 1946063002: Replace DeviceManager::GetDeviceChanges with a client interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@proper_stubs
Patch Set: Rebase.d Created 4 years, 7 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-iframe.html
diff --git a/third_party/WebKit/LayoutTests/usb/usbDevice-iframe.html b/third_party/WebKit/LayoutTests/usb/usbDevice-iframe.html
index a05bd8592e7ef4b74a26ab03fb6a8e270385c147..e3b6cf117d202317f231f7a7662e3ce4058cd737 100644
--- a/third_party/WebKit/LayoutTests/usb/usbDevice-iframe.html
+++ b/third_party/WebKit/LayoutTests/usb/usbDevice-iframe.html
@@ -57,4 +57,37 @@ usb_test(usb => {
iframe.src = 'about:blank';
});
}, 'navigating iframe disconnects device.');
+
+usb_test(usb => {
+ return new Promise((resolve, reject) => {
+ let mockDeviceManager = new usb.MockDeviceManager;
+ let iframe = document.createElement('iframe');
+
+ window.onmessage = messageEvent => {
+ if (messageEvent.data === 'Ready') {
+ document.body.removeChild(iframe);
+ runGarbageCollection().then(() => {
+ mockDeviceManager.addMockDevice(usb.fakeDevices[0]);
+ resolve();
+ });
+ } else {
+ reject(messageEvent.data);
+ }
+ };
+
+ iframe.src = 'resources/open-in-iframe.html';
+ iframe.onload = () => {
+ iframe.contentWindow.mojo.define(
+ "Mojo Service Registry",
+ [ 'content/public/renderer/frame_service_registry' ],
+ (frameServiceRegistry) => {
+ frameServiceRegistry.addServiceOverrideForTesting(
+ usb.DeviceManager.name,
+ pipe => { mockDeviceManager.bindToPipe(pipe); });
+ iframe.contentWindow.postMessage('Ready', '*');
+ });
+ }
+ document.body.appendChild(iframe);
+ });
+}, 'events are not delivered to detached frames');
</script>
« 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