tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

usbConfiguration.https.any.js (884B)


      1 // META: script=/resources/test-only-api.js
      2 // META: script=/webusb/resources/fake-devices.js
      3 // META: script=/webusb/resources/usb-helpers.js
      4 'use strict';
      5 
      6 usb_test(async () => {
      7  let { device } = await getFakeDevice();
      8  let configuration = new USBConfiguration(
      9      device, device.configurations[1].configurationValue);
     10  assertDeviceInfoEquals(configuration, fakeDeviceInit.configurations[1]);
     11 }, 'Can construct a USBConfiguration.');
     12 
     13 usb_test(async () => {
     14  let { device } = await getFakeDevice();
     15  try {
     16    let configuration =
     17        new USBConfiguration(device, device.configurations.length + 1);
     18    assert_unreached(
     19        'USBConfiguration should reject an invalid configuration value');
     20  } catch (error) {
     21    assert_equals(error.name, 'RangeError');
     22  }
     23 }, 'Constructing a USBConfiguration with an invalid configuration value ' +
     24    'throws a range error.');