Chromium Code Reviews| 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..7afa88e9e31a8bed44ddc49aee5aec6b803d1939 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,43 @@ |
| 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 && |
|
foolip
2017/04/10 07:48:54
This is essentially how I'd like tests like this t
|
| + navigator.usb.test.initialize) { |
| + navigator.usb.test.initialize().then(() => { |
| + navigator.usb.test.addFakeDevice(fakeDeviceInit); |
| + navigator.usb.getDevices().then(devices => { |
| + usbDevice = devices[0]; |
| + 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(); |
| + }); |
| + }); |
| + } else { |
| + idl_array.test(); |
| + } |
| </script> |
| </body> |
| </html> |