Bug 1735858 [wpt PR 31247] - App history: make it mostly nonfunctional for opaque...
[gecko.git] / testing / web-platform / tests / serial / serialPort_readable_smallRead.https.any.js
blobb53ea71443d44f23aa80326b65b1f7501d7846dc
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]);
14   fakePort.write(data);
16   let {value, done} = await reader.read();
17   assert_false(done);
18   compareArrays(data, value);
19   reader.releaseLock();
21   await port.close();
22 }, 'Can read a small amount of data');