Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: third_party/WebKit/LayoutTests/usb/usb-isochronous-in-transfer-result.html

Issue 2789723003: Migrate WebUSB LayoutTests into external/wpt (Closed)
Patch Set: Add README.md and more comments explaining the polyfill Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
8 test(t => {
9 let data_view = new DataView(Uint8Array.from([1, 2, 3, 4]).buffer);
10 let packet_data_view = new DataView(data_view.buffer);
11 let packets = [
12 new USBIsochronousInTransferPacket('ok', packet_data_view),
13 new USBIsochronousInTransferPacket('stall')
14 ];
15
16 let result = new USBIsochronousInTransferResult(packets, data_view);
17 assert_equals(result.data.getInt32(0), 16909060);
18 assert_equals(result.packets.length, 2);
19 assert_equals(result.packets[0].status, 'ok');
20 assert_equals(result.packets[0].data.getInt32(0), 16909060);
21 assert_equals(result.packets[1].status, 'stall');
22 assert_equals(result.packets[1].data, null);
23 }, 'Can construct a USBIsochronousInTransferResult');
24
25 test(t => {
26 let packets = [
27 new USBIsochronousInTransferPacket('stall'),
28 new USBIsochronousInTransferPacket('stall')
29 ];
30 let result = new USBIsochronousInTransferResult(packets);
31 assert_equals(result.data, null);
32 assert_equals(result.packets.length, 2);
33 assert_equals(result.packets[0].status, 'stall');
34 assert_equals(result.packets[0].data, null);
35 assert_equals(result.packets[1].status, 'stall');
36 assert_equals(result.packets[1].data, null);
37 }, 'Can construct a USBIsochronousInTransferResult without a DataView');
38
39 test(t => {
40 assert_throws(TypeError(), () => new USBIsochronousInTransferResult());
41 }, 'Cannot construct a USBIsochronousInTransferResult without packets');
42 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698