OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../resources/testharness.js"></script> | 2 <script src="/resources/testharness.js"></script> |
3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="/resources/testharnessreport.js"></script> |
4 <script> | 4 <script> |
5 'use strict'; | 5 'use strict'; |
6 | 6 |
7 test(t => { | 7 test(t => { |
8 let packets = [ | 8 let packets = [ |
9 new USBIsochronousOutTransferPacket('ok', 42), | 9 new USBIsochronousOutTransferPacket('ok', 42), |
10 new USBIsochronousOutTransferPacket('stall') | 10 new USBIsochronousOutTransferPacket('stall') |
11 ]; | 11 ]; |
12 | 12 |
13 let result = new USBIsochronousOutTransferResult(packets); | 13 let result = new USBIsochronousOutTransferResult(packets); |
14 assert_equals(result.packets.length, 2); | 14 assert_equals(result.packets.length, 2); |
15 assert_equals(result.packets[0].status, 'ok'); | 15 assert_equals(result.packets[0].status, 'ok'); |
16 assert_equals(result.packets[0].bytesWritten, 42); | 16 assert_equals(result.packets[0].bytesWritten, 42); |
17 assert_equals(result.packets[1].status, 'stall'); | 17 assert_equals(result.packets[1].status, 'stall'); |
18 assert_equals(result.packets[1].bytesWritten, 0); | 18 assert_equals(result.packets[1].bytesWritten, 0); |
19 }, 'Can construct a USBIsochronousOutTransferResult'); | 19 }, 'Can construct a USBIsochronousOutTransferResult'); |
20 | 20 |
21 test(t => { | 21 test(t => { |
22 assert_throws(TypeError(), () => new USBIsochronousOutTransferResult()); | 22 assert_throws(TypeError(), () => new USBIsochronousOutTransferResult()); |
23 }, 'Cannot construct a USBIsochronousOutTransferResult without packets'); | 23 }, 'Cannot construct a USBIsochronousOutTransferResult without packets'); |
24 </script> | 24 </script> |
OLD | NEW |