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 && |
| 225 navigator.usb.test.initialize) { |
| 226 navigator.usb.test.initialize().then(() => { |
| 227 navigator.usb.onconnect = evt => { |
| 228 usbDevice = evt.device; |
| 229 usbConfiguration = usbDevice.configurations[0]; |
| 230 usbInterface = usbConfiguration.interfaces[0]; |
| 231 usbAlternateInterface = usbInterface.alternates[0]; |
| 232 usbEndpoint = usbAlternateInterface.endpoints[0]; |
| 233 usbConnectionEvent = |
| 234 new USBConnectionEvent('connect', { device: usbDevice }) |
| 235 |
| 236 idl_array.add_objects({ |
| 237 USBAlternateInterface: ['usbAlternateInterface'], |
| 238 USBConfiguration: ['usbConfiguration'], |
| 239 USBConnectionEvent: ['usbConnectionEvent'], |
| 240 USBDevice: ['usbDevice'], |
| 241 USBEndpoint: ['usbEndpoint'], |
| 242 USBInterface: ['usbInterface'] |
| 243 }); |
| 244 |
| 245 idl_array.test(); |
| 246 }; |
| 247 |
| 248 navigator.usb.test.addFakeDevice(fakeDeviceInit); |
| 249 }); |
| 250 } else { |
| 251 idl_array.test(); |
| 252 } |
215 </script> | 253 </script> |
216 </body> | 254 </body> |
217 </html> | 255 </html> |
OLD | NEW |