summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webusb/idlharness.https.any.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/webusb/idlharness.https.any.js
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webusb/idlharness.https.any.js')
-rw-r--r--testing/web-platform/tests/webusb/idlharness.https.any.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webusb/idlharness.https.any.js b/testing/web-platform/tests/webusb/idlharness.https.any.js
new file mode 100644
index 0000000000..0c8cb322a0
--- /dev/null
+++ b/testing/web-platform/tests/webusb/idlharness.https.any.js
@@ -0,0 +1,47 @@
+// META: timeout=long
+// META: script=/resources/WebIDLParser.js
+// META: script=/resources/idlharness.js
+// META: script=/resources/test-only-api.js
+// META: script=/webusb/resources/fake-devices.js
+// META: script=/webusb/resources/usb-helpers.js
+
+'use strict';
+
+idl_test(
+ ['webusb'],
+ ['permissions', 'html', 'dom'],
+ async idl_array => {
+ if (self.GLOBAL.isWindow()) {
+ idl_array.add_objects({ Navigator: ['navigator'] });
+ } else if (self.GLOBAL.isWorker()) {
+ idl_array.add_objects({ WorkerNavigator: ['navigator'] });
+ }
+
+ idl_array.add_objects({
+ USB: ['navigator.usb'],
+ USBAlternateInterface: ['usbAlternateInterface'],
+ USBConfiguration: ['usbConfiguration'],
+ USBConnectionEvent: ['usbConnectionEvent'],
+ USBDevice: ['usbDevice'],
+ USBEndpoint: ['usbEndpoint'],
+ USBInterface: ['usbInterface'],
+ USBInTransferResult: ['new USBInTransferResult("ok")'],
+ USBOutTransferResult: ['new USBOutTransferResult("ok")'],
+ USBIsochronousInTransferResult: ['new USBIsochronousInTransferResult([])'],
+ USBIsochronousOutTransferResult: ['new USBIsochronousOutTransferResult([])'],
+ USBIsochronousInTransferPacket: ['new USBIsochronousInTransferPacket("ok")'],
+ USBIsochronousOutTransferPacket: ['new USBIsochronousOutTransferPacket("ok")'],
+ });
+
+ return usb_test(async () => {
+ // Ignored errors are surfaced in idlharness.js's test_object below.
+ self.usbDevice = await getFakeDevice().device;
+ self.usbConfiguration = usbDevice.configurations[0];
+ self.usbInterface = usbConfiguration.interfaces[0];
+ self.usbAlternateInterface = usbInterface.alternates[0];
+ self.usbEndpoint = usbAlternateInterface.endpoints[0];
+ self.usbConnectionEvent =
+ new USBConnectionEvent('connect', { device: usbDevice });
+ }, 'USB device setup');
+ }
+);