| OLD | NEW |
| (Empty) |
| 1 'use strict'; | |
| 2 | |
| 3 function fakeUsbDevices() { | |
| 4 return define('Fake USB Devices', [ | |
| 5 'device/usb/public/interfaces/device.mojom', | |
| 6 ], device => Promise.resolve([ | |
| 7 { | |
| 8 guid: 'CD9FA048-FC9B-7A71-DBFC-FD44B78D6397', | |
| 9 usb_version_major: 2, | |
| 10 usb_version_minor: 0, | |
| 11 usb_version_subminor: 0, | |
| 12 class_code: 7, | |
| 13 subclass_code: 1, | |
| 14 protocol_code: 2, | |
| 15 vendor_id: 0x18d1, | |
| 16 product_id: 0xf00d, | |
| 17 device_version_major: 1, | |
| 18 device_version_minor: 2, | |
| 19 device_version_subminor: 3, | |
| 20 manufacturer_name: 'Google, Inc.', | |
| 21 product_name: 'The amazing imaginary printer', | |
| 22 serial_number: '4', | |
| 23 active_configuration: 0, | |
| 24 configurations: [ | |
| 25 { | |
| 26 configuration_value: 1, | |
| 27 configuration_name: 'Printer Mode', | |
| 28 interfaces: [ | |
| 29 { | |
| 30 interface_number: 0, | |
| 31 alternates: [ | |
| 32 { | |
| 33 alternate_setting: 0, | |
| 34 class_code: 0xff, | |
| 35 subclass_code: 0x01, | |
| 36 protocol_code: 0x01, | |
| 37 interface_name: 'Control', | |
| 38 endpoints: [ | |
| 39 { | |
| 40 endpoint_number: 1, | |
| 41 direction: device.TransferDirection.INBOUND, | |
| 42 type: device.EndpointType.INTERRUPT, | |
| 43 packet_size: 8 | |
| 44 } | |
| 45 ] | |
| 46 } | |
| 47 ] | |
| 48 }, | |
| 49 { | |
| 50 interface_number: 1, | |
| 51 alternates: [ | |
| 52 { | |
| 53 alternate_setting: 0, | |
| 54 class_code: 0xff, | |
| 55 subclass_code: 0x02, | |
| 56 protocol_code: 0x01, | |
| 57 interface_name: 'Data', | |
| 58 endpoints: [ | |
| 59 { | |
| 60 endpoint_number: 2, | |
| 61 direction: device.TransferDirection.INBOUND, | |
| 62 type: device.EndpointType.BULK, | |
| 63 packet_size: 1024 | |
| 64 }, | |
| 65 { | |
| 66 endpoint_number: 2, | |
| 67 direction: device.TransferDirection.OUTBOUND, | |
| 68 type: device.EndpointType.BULK, | |
| 69 packet_size: 1024 | |
| 70 } | |
| 71 ] | |
| 72 } | |
| 73 ] | |
| 74 } | |
| 75 ] | |
| 76 }, | |
| 77 { | |
| 78 configuration_value: 2, | |
| 79 configuration_name: 'Fighting Robot Mode', | |
| 80 interfaces: [ | |
| 81 { | |
| 82 interface_number: 0, | |
| 83 alternates: [ | |
| 84 { | |
| 85 alternate_setting: 0, | |
| 86 class_code: 0xff, | |
| 87 subclass_code: 0x42, | |
| 88 protocol_code: 0x01, | |
| 89 interface_name: 'Disabled', | |
| 90 endpoints: [] | |
| 91 }, | |
| 92 { | |
| 93 alternate_setting: 1, | |
| 94 class_code: 0xff, | |
| 95 subclass_code: 0x42, | |
| 96 protocol_code: 0x01, | |
| 97 interface_name: 'Activate!', | |
| 98 endpoints: [ | |
| 99 { | |
| 100 endpoint_number: 1, | |
| 101 direction: device.TransferDirection.INBOUND, | |
| 102 type: device.EndpointType.ISOCHRONOUS, | |
| 103 packet_size: 1024 | |
| 104 }, | |
| 105 { | |
| 106 endpoint_number: 1, | |
| 107 direction: device.TransferDirection.OUTBOUND, | |
| 108 type: device.EndpointType.ISOCHRONOUS, | |
| 109 packet_size: 1024 | |
| 110 } | |
| 111 ] | |
| 112 } | |
| 113 ] | |
| 114 }, | |
| 115 ] | |
| 116 } | |
| 117 ], | |
| 118 webusb_allowed_origins: { origins: [], configurations: [] }, | |
| 119 } | |
| 120 ])); | |
| 121 } | |
| 122 | |
| 123 let fakeDeviceInit = { | |
| 124 usbVersionMajor: 2, | |
| 125 usbVersionMinor: 0, | |
| 126 usbVersionSubminor: 0, | |
| 127 deviceClass: 7, | |
| 128 deviceSubclass: 1, | |
| 129 deviceProtocol: 2, | |
| 130 vendorId: 0x18d1, | |
| 131 productId: 0xf00d, | |
| 132 deviceVersionMajor: 1, | |
| 133 deviceVersionMinor: 2, | |
| 134 deviceVersionSubminor: 3, | |
| 135 manufacturerName: 'Google, Inc.', | |
| 136 productName: 'The amazing imaginary printer', | |
| 137 serialNumber: '4', | |
| 138 activeConfigurationValue: 0, | |
| 139 configurations: [{ | |
| 140 configurationValue: 1, | |
| 141 configurationName: 'Printer Mode', | |
| 142 interfaces: [{ | |
| 143 interfaceNumber: 0, | |
| 144 alternates: [{ | |
| 145 alternateSetting: 0, | |
| 146 interfaceClass: 0xff, | |
| 147 interfaceSubclass: 0x01, | |
| 148 interfaceProtocol: 0x01, | |
| 149 interfaceName: 'Control', | |
| 150 endpoints: [{ | |
| 151 endpointNumber: 1, | |
| 152 direction: 'in', | |
| 153 type: 'interrupt', | |
| 154 packetSize: 8 | |
| 155 }] | |
| 156 }] | |
| 157 }, { | |
| 158 interfaceNumber: 1, | |
| 159 alternates: [{ | |
| 160 alternateSetting: 0, | |
| 161 interfaceClass: 0xff, | |
| 162 interfaceSubclass: 0x02, | |
| 163 interfaceProtocol: 0x01, | |
| 164 interfaceName: 'Data', | |
| 165 endpoints: [{ | |
| 166 endpointNumber: 2, | |
| 167 direction: 'in', | |
| 168 type: 'bulk', | |
| 169 packetSize: 1024 | |
| 170 }, { | |
| 171 endpointNumber: 2, | |
| 172 direction: 'out', | |
| 173 type: 'bulk', | |
| 174 packetSize: 1024 | |
| 175 }] | |
| 176 }] | |
| 177 }] | |
| 178 }, { | |
| 179 configurationValue: 2, | |
| 180 configurationName: 'Fighting Robot Mode', | |
| 181 interfaces: [{ | |
| 182 interfaceNumber: 0, | |
| 183 alternates: [{ | |
| 184 alternateSetting: 0, | |
| 185 interfaceClass: 0xff, | |
| 186 interfaceSubclass: 0x42, | |
| 187 interfaceProtocol: 0x01, | |
| 188 interfaceName: 'Disabled', | |
| 189 endpoints: [] | |
| 190 }, { | |
| 191 alternateSetting: 1, | |
| 192 interfaceClass: 0xff, | |
| 193 interfaceSubclass: 0x42, | |
| 194 interfaceProtocol: 0x01, | |
| 195 interfaceName: 'Activate!', | |
| 196 endpoints: [{ | |
| 197 endpointNumber: 1, | |
| 198 direction: 'in', | |
| 199 type: 'isochronous', | |
| 200 packetSize: 1024 | |
| 201 }, { | |
| 202 endpointNumber: 1, | |
| 203 direction: 'out', | |
| 204 type: 'isochronous', | |
| 205 packetSize: 1024 | |
| 206 }] | |
| 207 }] | |
| 208 }] | |
| 209 }] | |
| 210 }; | |
| OLD | NEW |