https://github.com/web-platform-tests/wpt
Raw File
Tip revision: feeda08fb7c8a7c57afb1448d118942236ef6c94 authored by Coroiu Cristina on 26 November 2018, 20:19:20 UTC
Backed out changeset d32110a492f5 (bug 1383454) for did not disable the test
Tip revision: feeda08
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