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 data_view = new DataView(Uint8Array.from([1, 2, 3, 4]).buffer); | 8 let data_view = new DataView(Uint8Array.from([1, 2, 3, 4]).buffer); |
9 let result = new USBInTransferResult('ok', data_view); | 9 let result = new USBInTransferResult('ok', data_view); |
10 assert_equals(result.status, 'ok'); | 10 assert_equals(result.status, 'ok'); |
11 assert_equals(result.data.getInt32(0), 16909060); | 11 assert_equals(result.data.getInt32(0), 16909060); |
12 }, 'Can construct a USBInTransferResult'); | 12 }, 'Can construct a USBInTransferResult'); |
13 | 13 |
14 test(t => { | 14 test(t => { |
15 let result = new USBInTransferResult('stall'); | 15 let result = new USBInTransferResult('stall'); |
16 assert_equals(result.status, 'stall'); | 16 assert_equals(result.status, 'stall'); |
17 assert_equals(result.data, null); | 17 assert_equals(result.data, null); |
18 | 18 |
19 result = new USBInTransferResult('babble', null); | 19 result = new USBInTransferResult('babble', null); |
20 assert_equals(result.status, 'babble'); | 20 assert_equals(result.status, 'babble'); |
21 assert_equals(result.data, null); | 21 assert_equals(result.data, null); |
22 }, 'Can construct a USBInTransferResult without a DataView'); | 22 }, 'Can construct a USBInTransferResult without a DataView'); |
23 | 23 |
24 test(t => { | 24 test(t => { |
25 assert_throws(TypeError(), () => new USBInTransferResult('invalid_status')); | 25 assert_throws(TypeError(), () => new USBInTransferResult('invalid_status')); |
26 }, 'Cannot construct USBInTransferResult with an invalid status'); | 26 }, 'Cannot construct USBInTransferResult with an invalid status'); |
27 | 27 |
28 test(t => { | 28 test(t => { |
29 assert_throws(TypeError(), () => new USBInTransferResult()); | 29 assert_throws(TypeError(), () => new USBInTransferResult()); |
30 }, 'Cannot construct USBInTransferResult without a status'); | 30 }, 'Cannot construct USBInTransferResult without a status'); |
31 </script> | 31 </script> |
OLD | NEW |