Bug 1826537 - Part 3: Add WebTransport stream test for being closed with no data r=smaug

To make sure the refactoring doesn't break it.

Differential Revision: https://phabricator.services.mozilla.com/D175254
This commit is contained in:
Kagami Sascha Rosylight 2023-04-13 11:22:54 +00:00
Родитель d4669f4fac
Коммит ede5a7632c
2 изменённых файлов: 30 добавлений и 0 удалений

Просмотреть файл

@ -21,6 +21,9 @@
[Transfer large chunks of data on a unidirectional stream]
expected: [PASS, TIMEOUT, NOTRUN]
[Closing the stream with no data still resolves the read request]
expected: [PASS, TIMEOUT, NOTRUN]
[streams-echo.https.any.worker.html]
expected: [OK, TIMEOUT]
@ -45,6 +48,9 @@
[Transfer large chunks of data on a unidirectional stream]
expected: [PASS, TIMEOUT, NOTRUN]
[Closing the stream with no data still resolves the read request]
expected: [PASS, TIMEOUT, NOTRUN]
[streams-echo.https.any.sharedworker.html]
expected: [OK, TIMEOUT]
@ -69,6 +75,9 @@
[Transfer large chunks of data on a unidirectional stream]
expected: [PASS, TIMEOUT, NOTRUN]
[Closing the stream with no data still resolves the read request]
expected: [PASS, TIMEOUT, NOTRUN]
[streams-echo.https.any.serviceworker.html]
expected: [OK, TIMEOUT]
@ -92,3 +101,6 @@
[Transfer large chunks of data on a unidirectional stream]
expected: [PASS, TIMEOUT, NOTRUN]
[Closing the stream with no data still resolves the read request]
expected: [PASS, TIMEOUT, NOTRUN]

Просмотреть файл

@ -213,3 +213,21 @@ promise_test(async t => {
assert_equals(len, 3*bytes.length);
}, 'Transfer large chunks of data on a unidirectional stream');
promise_test(async t => {
// Establish a WebTransport session.
const wt = new WebTransport(webtransport_url('echo.py'));
await wt.ready;
// Create a bidirectional stream.
const bidi_stream = await wt.createBidirectionalStream();
// Close the writable end with no data at all.
const writer = bidi_stream.writable.getWriter();
writer.close();
// Read the data on the readable end.
const chunks = await read_stream(bidi_stream.readable);
assert_equals(chunks.length, 0);
await bidi_stream.readable.closed;
}, 'Closing the stream with no data still resolves the read request');