Files
sousa-gecko/testing/web-platform/tests/webtransport/congestion-control.https.any.js
T
Himanshu Panwar 620f1c1148 Bug 2035707 [wpt PR 59463] - WebTransport: Add congestionControl hint (W3C spec compliance), a=testonly
Automatic update from web-platform-tests
WebTransport: Add congestionControl hint (W3C spec compliance)

Implement the WebTransportCongestionControl enum, constructor option,
and readonly attribute per the W3C WebTransport spec.

The spec defines congestionControl as a hint for the preferred
congestion control algorithm — an enum {"default", "throughput",
"low-latency"} passed via WebTransportOptions and readable as a readonly
attribute on WebTransport.

Plumbing through all layers:
  - Blink: New enum IDL, option, getter, Blink→Mojo conversion
  - Mojo IPC: New enum + parameter on Connect() and CreateWebTransport()
  - Browser: Thread through throttle/security callback chain
  - Network service: Convert Mojo enum → net::CongestionControlHint
  - net/QUIC: AdjustSendAlgorithm() maps "throughput" → BBR v2,
  "low-latency" → BBR v1, "default" → no change (Cubic)

A global kWebTransportCongestionControl feature flag overrides
per-connection hints for Chrome-wide experiments.

Bug: 501268547
Change-Id: I6d0d7163fdb777058b940d9b9f699ee65c631dfe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7743543
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Adam Rice <ricea@chromium.org>
Commit-Queue: Himanshu Panwar <himpanwar@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1620659}

--

wpt-commits: 7cb0bce2608006c5c16961d970248508d1724d5e
wpt-pr: 59463
2026-05-08 08:33:38 +00:00

41 lines
1.5 KiB
JavaScript

// META: global=window,worker
// META: script=resources/webtransport-test-helpers.sub.js
// META: script=/common/utils.js
// Tests that a WebTransport session can be established when congestionControl
// is specified in the constructor, and that the attribute is readable.
const CONGESTION_CONTROL_VALUES = ["default", "throughput", "low-latency"];
for (const value of CONGESTION_CONTROL_VALUES) {
promise_test(async t => {
const id = token();
const wt = new WebTransport(
webtransport_url(`client-close.py?token=${id}`),
{congestionControl: value});
await wt.ready;
// The congestionControl attribute should be readable after connection.
// The spec says if the UA doesn't support the requested algorithm, it
// falls back to "default". So the value is either what was requested or
// "default".
assert_in_array(wt.congestionControl, [value, "default"],
'congestionControl should be the requested value or "default"');
wt.close();
}, `WebTransport session established with congestionControl "${value}" and attribute is readable`);
}
promise_test(async t => {
const id = token();
const wt = new WebTransport(
webtransport_url(`client-close.py?token=${id}`));
await wt.ready;
// When no congestionControl is specified, the default should be used.
assert_equals(wt.congestionControl, "default",
'congestionControl should default to "default"');
wt.close();
}, 'WebTransport session without congestionControl option defaults to "default"');