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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/webusb/idlharness.https.html

Issue 2789723003: Migrate WebUSB LayoutTests into external/wpt (Closed)
Patch Set: Upstream tests that will work in stable Chrome 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
Index: third_party/WebKit/LayoutTests/external/wpt/webusb/idlharness.https.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webusb/idlharness.https.html b/third_party/WebKit/LayoutTests/external/wpt/webusb/idlharness.https.html
index 8cee0434159d0a03b8fb3b3ab4138a738e2d43cc..c507d6512f5fceaf9b2989dd24f982d3bf65c9f1 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/webusb/idlharness.https.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/webusb/idlharness.https.html
@@ -8,6 +8,7 @@
<script src=/resources/testharnessreport.js></script>
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>
+ <script src=resources/fake-devices.js></script>
</head>
<body>
<script type="text/plain" id="untested">
@@ -211,7 +212,44 @@
USBIsochronousInTransferPacket: ['new USBIsochronousInTransferPacket("ok")'],
USBIsochronousOutTransferPacket: ['new USBIsochronousOutTransferPacket("ok")']
});
- idl_array.test();
+
+ // These types require a USBDevice instance to construct:
+ var usbAlternateInterface;
+ var usbConfiguration;
+ var usbConnectionEvent;
+ var usbDevice;
+ var usbEndpoint;
+ var usbInterface;
+
+ if (navigator.usb.test &&
+ navigator.usb.test.initialize) {
+ navigator.usb.test.initialize().then(() => {
+ navigator.usb.onconnect = evt => {
+ usbDevice = evt.device;
+ usbConfiguration = usbDevice.configurations[0];
+ usbInterface = usbConfiguration.interfaces[0];
+ usbAlternateInterface = usbInterface.alternates[0];
+ usbEndpoint = usbAlternateInterface.endpoints[0];
+ usbConnectionEvent =
+ new USBConnectionEvent('connect', { device: usbDevice })
+
+ idl_array.add_objects({
+ USBAlternateInterface: ['usbAlternateInterface'],
+ USBConfiguration: ['usbConfiguration'],
+ USBConnectionEvent: ['usbConnectionEvent'],
+ USBDevice: ['usbDevice'],
+ USBEndpoint: ['usbEndpoint'],
+ USBInterface: ['usbInterface']
+ });
+
+ idl_array.test();
+ };
+
+ navigator.usb.test.addFakeDevice(fakeDeviceInit);
+ });
+ } else {
+ idl_array.test();
+ }
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698