mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-13 20:14:57 -10:00
Automatic update from web-platform-tests serial: Add manual test for control flow behavior This test uses a device configured for loopback (with RTS and CTS) lines connected to validate that the RTS pin can be configured manually or automatically depending on the flow control configuration. Bug: 1287309 Change-Id: Id260d41fcb714529bf3e3754608db6485d2901e2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3390190 Auto-Submit: Reilly Grant <[email protected]> Reviewed-by: Matt Reynolds <[email protected]> Commit-Queue: Matt Reynolds <[email protected]> Cr-Commit-Position: refs/heads/main@{#961185} -- wpt-commits: ee6da9d71d0268d7fdb04e8e5b26858f46ee0cc4 wpt-pr: 32390
60 lines
1.7 KiB
HTML
60 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title></title>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="resources/common.js"></script>
|
|
<script src="resources/manual.js"></script>
|
|
</head>
|
|
<body>
|
|
<p>
|
|
These tests require a connected serial device configured to act as a
|
|
"loopback" device, with the TX and RX pins and RTS and CTS pins wired
|
|
together.
|
|
</p>
|
|
<script>
|
|
manual_serial_test(async (t, port) => {
|
|
await port.open({
|
|
baudRate: 115200,
|
|
bufferSize: 255,
|
|
flowControl: 'none'
|
|
});
|
|
t.add_cleanup(async () => {
|
|
await port.close();
|
|
});
|
|
|
|
await port.setSignals({ requestToSend: true });
|
|
let signals = await port.getSignals();
|
|
assert_true(signals.clearToSend);
|
|
|
|
await port.setSignals({ requestToSend: false });
|
|
signals = await port.getSignals();
|
|
assert_false(signals.clearToSend);
|
|
}, 'Manual RTS control works with no flow control enabled');
|
|
|
|
manual_serial_test(async (t, port) => {
|
|
await port.open({
|
|
baudRate: 115200,
|
|
bufferSize: 255,
|
|
flowControl: 'hardware'
|
|
});
|
|
|
|
const writer = port.writable.getWriter();
|
|
t.add_cleanup(async () => {
|
|
writer.releaseLock();
|
|
await port.close();
|
|
});
|
|
|
|
assert_true((await port.getSignals()).clearToSend);
|
|
|
|
const buffer = new Uint8Array(1);
|
|
while ((await port.getSignals()).clearToSend) {
|
|
await writer.write(buffer);
|
|
}
|
|
}, 'Hardware flow control automatically sets RTS pin');
|
|
</script>
|
|
</body>
|
|
</html>
|