1 // META: script=/resources/test-only-api.js
2 // META: script=/serial/resources/common.js
3 // META: script=resources/automation.js
5 serial_test(async (t, fake) => {
6 const {port, fakePort} = await getFakeSerialPort(fake);
7 // Select a buffer size larger than the amount of data transferred.
8 await port.open({baudRate: 9600, bufferSize: 64});
10 const reader = port.readable.getReader();
12 await fakePort.writable();
13 const data = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
16 let {value, done} = await reader.read();
18 compareArrays(data, value);
22 }, 'Can read a small amount of data');