Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /webtransport/incoming-multiple-streams.https.any.html - WPT Dashboard Interop Dashboard
- /webtransport/incoming-multiple-streams.https.any.serviceworker.html - WPT Dashboard Interop Dashboard
- /webtransport/incoming-multiple-streams.https.any.sharedworker.html - WPT Dashboard Interop Dashboard
- /webtransport/incoming-multiple-streams.https.any.worker.html - WPT Dashboard Interop Dashboard
// META: global=window,worker
// META: script=resources/webtransport-test-helpers.sub.js
// META: timeout=long
promise_test(async t => {
const NUM_STREAMS = 5;
const wt = new WebTransport(
webtransport_url(
`server-create-multiple-streams.py?type=unidi&count=${NUM_STREAMS}`));
await wt.ready;
const reader = wt.incomingUnidirectionalStreams.getReader();
let received = [];
for (let i = 0; i < NUM_STREAMS; i++) {
const {value: stream} = await reader.read();
const data = await read_stream_as_string(stream);
received.push(data);
}
reader.releaseLock();
received.sort();
for (let i = 0; i < NUM_STREAMS; i++) {
assert_equals(received[i], `stream${i}`);
}
wt.close();
}, 'Multiple server-initiated unidirectional streams should all be received');
promise_test(async t => {
const NUM_STREAMS = 5;
const wt = new WebTransport(
webtransport_url(
`server-create-multiple-streams.py?type=bidi&count=${NUM_STREAMS}`));
await wt.ready;
const reader = wt.incomingBidirectionalStreams.getReader();
let received = [];
for (let i = 0; i < NUM_STREAMS; i++) {
const {value: stream} = await reader.read();
const data = await read_stream_as_string(stream.readable);
received.push(data);
}
reader.releaseLock();
received.sort();
for (let i = 0; i < NUM_STREAMS; i++) {
assert_equals(received[i], `stream${i}`);
}
wt.close();
}, 'Multiple server-initiated bidirectional streams should all be received');