OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <script src="../resources/testharness.js"></script> | |
3 <script src="../resources/testharnessreport.js"></script> | |
4 <script> | |
5 'use strict'; | |
6 | |
7 test(t => { | |
8 let data_view = new DataView(Uint8Array.from([1, 2, 3, 4]).buffer); | |
9 let packet = new USBIsochronousInTransferPacket('ok', data_view); | |
10 assert_equals(packet.status, 'ok'); | |
11 assert_equals(packet.data.getInt32(0), 16909060); | |
12 }, 'Can construct a USBIsochronousInTransferPacket'); | |
13 | |
14 test(t => { | |
15 let packet = new USBIsochronousInTransferPacket('stall'); | |
16 assert_equals(packet.status, 'stall'); | |
17 assert_equals(packet.data, null); | |
18 | |
19 packet = new USBIsochronousInTransferPacket('stall', null); | |
20 assert_equals(packet.status, 'stall'); | |
21 assert_equals(packet.data, null); | |
22 }, 'Can construct a USBIsochronousInTransferPacket without a DataView'); | |
23 | |
24 test(t => { | |
25 assert_throws(TypeError(), () => { | |
26 new USBIsochronousInTransferPacket('invalid_status'); | |
27 }); | |
28 }, 'Cannot construct USBIsochronousInTransferPacket with an invalid status'); | |
29 | |
30 test(t => { | |
31 assert_throws(TypeError(), () => new USBIsochronousInTransferPacket()); | |
32 }, 'Cannot construct USBIsochronousInTransferPacket without a status'); | |
33 </script> | |
OLD | NEW |