Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <meta charset=utf-8> | 4 <meta charset=utf-8> |
| 5 <title>WebUSB IDL test</title> | 5 <title>WebUSB IDL test</title> |
| 6 <link rel="help" href="https://wicg.github.io/webusb/"> | 6 <link rel="help" href="https://wicg.github.io/webusb/"> |
| 7 <script src=/resources/testharness.js></script> | 7 <script src=/resources/testharness.js></script> |
| 8 <script src=/resources/testharnessreport.js></script> | 8 <script src=/resources/testharnessreport.js></script> |
| 9 <script src=/resources/WebIDLParser.js></script> | 9 <script src=/resources/WebIDLParser.js></script> |
| 10 <script src=/resources/idlharness.js></script> | 10 <script src=/resources/idlharness.js></script> |
| 11 <script src=resources/fake-devices.js></script> | |
| 11 </head> | 12 </head> |
| 12 <body> | 13 <body> |
| 13 <script type="text/plain" id="untested"> | 14 <script type="text/plain" id="untested"> |
| 14 interface Event {}; | 15 interface Event {}; |
| 15 dictionary EventInit {}; | 16 dictionary EventInit {}; |
| 16 interface EventHandler {}; | 17 interface EventHandler {}; |
| 17 interface EventTarget {}; | 18 interface EventTarget {}; |
| 18 interface Navigator {}; | 19 interface Navigator {}; |
| 19 </script> | 20 </script> |
| 20 <script type="text/plain" id="tested"> | 21 <script type="text/plain" id="tested"> |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 idl_array.add_objects({ | 205 idl_array.add_objects({ |
| 205 Navigator: ['navigator'], | 206 Navigator: ['navigator'], |
| 206 USB: ['navigator.usb'], | 207 USB: ['navigator.usb'], |
| 207 USBInTransferResult: ['new USBInTransferResult("ok")'], | 208 USBInTransferResult: ['new USBInTransferResult("ok")'], |
| 208 USBOutTransferResult: ['new USBOutTransferResult("ok")'], | 209 USBOutTransferResult: ['new USBOutTransferResult("ok")'], |
| 209 USBIsochronousInTransferResult: ['new USBIsochronousInTransferResult([]) '], | 210 USBIsochronousInTransferResult: ['new USBIsochronousInTransferResult([]) '], |
| 210 USBIsochronousOutTransferResult: ['new USBIsochronousOutTransferResult([ ])'], | 211 USBIsochronousOutTransferResult: ['new USBIsochronousOutTransferResult([ ])'], |
| 211 USBIsochronousInTransferPacket: ['new USBIsochronousInTransferPacket("ok ")'], | 212 USBIsochronousInTransferPacket: ['new USBIsochronousInTransferPacket("ok ")'], |
| 212 USBIsochronousOutTransferPacket: ['new USBIsochronousOutTransferPacket(" ok")'] | 213 USBIsochronousOutTransferPacket: ['new USBIsochronousOutTransferPacket(" ok")'] |
| 213 }); | 214 }); |
| 214 idl_array.test(); | 215 |
| 216 // These types require a USBDevice instance to construct: | |
| 217 var usbAlternateInterface; | |
| 218 var usbConfiguration; | |
| 219 var usbConnectionEvent; | |
| 220 var usbDevice; | |
| 221 var usbEndpoint; | |
| 222 var usbInterface; | |
| 223 | |
| 224 if (navigator.usb.test && | |
|
foolip
2017/04/10 07:48:54
This is essentially how I'd like tests like this t
| |
| 225 navigator.usb.test.initialize) { | |
| 226 navigator.usb.test.initialize().then(() => { | |
| 227 navigator.usb.test.addFakeDevice(fakeDeviceInit); | |
| 228 navigator.usb.getDevices().then(devices => { | |
| 229 usbDevice = devices[0]; | |
| 230 usbConfiguration = usbDevice.configurations[0]; | |
| 231 usbInterface = usbConfiguration.interfaces[0]; | |
| 232 usbAlternateInterface = usbInterface.alternates[0]; | |
| 233 usbEndpoint = usbAlternateInterface.endpoints[0]; | |
| 234 usbConnectionEvent = | |
| 235 new USBConnectionEvent('connect', { device: usbDevice }) | |
| 236 | |
| 237 idl_array.add_objects({ | |
| 238 USBAlternateInterface: ['usbAlternateInterface'], | |
| 239 USBConfiguration: ['usbConfiguration'], | |
| 240 USBConnectionEvent: ['usbConnectionEvent'], | |
| 241 USBDevice: ['usbDevice'], | |
| 242 USBEndpoint: ['usbEndpoint'], | |
| 243 USBInterface: ['usbInterface'] | |
| 244 }); | |
| 245 | |
| 246 idl_array.test(); | |
| 247 }); | |
| 248 }); | |
| 249 } else { | |
| 250 idl_array.test(); | |
| 251 } | |
| 215 </script> | 252 </script> |
| 216 </body> | 253 </body> |
| 217 </html> | 254 </html> |
| OLD | NEW |