Index: third_party/WebKit/LayoutTests/external/wpt/webusb/idlharness.https.html |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webusb/idlharness.html b/third_party/WebKit/LayoutTests/external/wpt/webusb/idlharness.https.html |
similarity index 85% |
rename from third_party/WebKit/LayoutTests/external/wpt/webusb/idlharness.html |
rename to third_party/WebKit/LayoutTests/external/wpt/webusb/idlharness.https.html |
index 8cee0434159d0a03b8fb3b3ab4138a738e2d43cc..c507d6512f5fceaf9b2989dd24f982d3bf65c9f1 100644 |
--- a/third_party/WebKit/LayoutTests/external/wpt/webusb/idlharness.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> |