https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 259d0612af038d14f2cd889a14a3adb6c9e96d96 authored by Josh Matthews on 23 December 2018, 05:25:51 UTC
Claim to support testdriver in servodriver
Tip revision: 259d061
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