diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/webusb/usbIsochronousInTransferResult.https.any.js | |
parent | Initial commit. (diff) | |
download | firefox-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/usbIsochronousInTransferResult.https.any.js')
-rw-r--r-- | testing/web-platform/tests/webusb/usbIsochronousInTransferResult.https.any.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webusb/usbIsochronousInTransferResult.https.any.js b/testing/web-platform/tests/webusb/usbIsochronousInTransferResult.https.any.js new file mode 100644 index 0000000000..0aa57d00e6 --- /dev/null +++ b/testing/web-platform/tests/webusb/usbIsochronousInTransferResult.https.any.js @@ -0,0 +1,36 @@ +'use strict'; + +test(t => { + let data_view = new DataView(Uint8Array.from([1, 2, 3, 4]).buffer); + let packet_data_view = new DataView(data_view.buffer); + let packets = [ + new USBIsochronousInTransferPacket('ok', packet_data_view), + new USBIsochronousInTransferPacket('stall') + ]; + + let result = new USBIsochronousInTransferResult(packets, data_view); + assert_equals(result.data.getInt32(0), 16909060); + assert_equals(result.packets.length, 2); + assert_equals(result.packets[0].status, 'ok'); + assert_equals(result.packets[0].data.getInt32(0), 16909060); + assert_equals(result.packets[1].status, 'stall'); + assert_equals(result.packets[1].data, null); +}, 'Can construct a USBIsochronousInTransferResult'); + +test(t => { + let packets = [ + new USBIsochronousInTransferPacket('stall'), + new USBIsochronousInTransferPacket('stall') + ]; + let result = new USBIsochronousInTransferResult(packets); + assert_equals(result.data, null); + assert_equals(result.packets.length, 2); + assert_equals(result.packets[0].status, 'stall'); + assert_equals(result.packets[0].data, null); + assert_equals(result.packets[1].status, 'stall'); + assert_equals(result.packets[1].data, null); +}, 'Can construct a USBIsochronousInTransferResult without a DataView'); + +test(t => { + assert_throws_js(TypeError, () => new USBIsochronousInTransferResult()); +}, 'Cannot construct a USBIsochronousInTransferResult without packets'); |