https://github.com/web-platform-tests/wpt
Raw File
Tip revision: e15d2c1a2afc866b09d31558d1af451227be2dca authored by Raymond Toy on 20 September 2018, 21:42:05 UTC
Sub-sample accurate start for ABSN
Tip revision: e15d2c1
usbConnectionEvent.https.any.js
// META: script=/webusb/resources/fake-devices.js
// META: script=/webusb/resources/usb-helpers.js

'use strict';

usb_test(() => getFakeDevice()
    .then(({ device }) => {
      let evt = new USBConnectionEvent('connect', { device: device });
      assert_equals(evt.type, 'connect');
      assert_equals(evt.device, device);
    }),
    'Can construct a USBConnectionEvent with a device');

test(t => {
  assert_throws(TypeError(),
      () => new USBConnectionEvent('connect', { device: null }));
  assert_throws(TypeError(),
      () => new USBConnectionEvent('connect', {}));
}, 'Cannot construct a USBConnectionEvent without a device');

done();
back to top