commit 53ae35cfae7246edb72f5c65b7dd55df9ca9e260
parent 42f4cdd2316ce40c80db8ef2f3886d0cbb4b8862
Author: Fredrik Hernqvist <fhernqvist@google.com>
Date: Thu, 27 Nov 2025 15:28:57 +0000
Bug 2002756 [wpt PR 56325] - Implement privacy mitigations for AudioPlayoutStats in WebAudio, a=testonly
Automatic update from web-platform-tests
Implement privacy mitigations for AudioPlayoutStats in WebAudio
These mitigations are described in
https://wicg.github.io/audio-context-playout-stats/#mitigations
The mitigations are tested locally on mac
The CL updates the existing wpt tests to be compatible with the
mitigations. It is probably not possible to test these mitigations in
wpt, because it is not possible to force the page not to be visible.
Any bounded timing-based tests would be flaky.
Change-Id: I8355ec3c58932fbc4c0ce325c26751bab4065eb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7073073
Reviewed-by: Olga Sharonova <olka@chromium.org>
Commit-Queue: Fredrik Hernqvist <fhernqvist@google.com>
Reviewed-by: Michael Wilson <mjwilson@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1550941}
--
wpt-commits: 8d8798377dbe55b3d8497512b809b568036689b6
wpt-pr: 56325
Diffstat:
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audiocontext-interface/audiocontext-playoutstats.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audiocontext-interface/audiocontext-playoutstats.html
@@ -27,12 +27,16 @@
assert_equals(stats.averageLatency, 0);
// Asynchronously wait for 1.5 seconds. We will then check that the
- // stats reflect that the context has been playing for at least 1
- // second. The extra 0.5 seconds is to avoid flakiness.
+ // stats reflect that the context has been playing for at least 0.9
+ // seconds. The 0.1 second margin is needed because the stats are
+ // updated once per second, and the context is not guaranteed to have
+ // been playing for exactly 1 second by the time they are updated.
+ // The extra 0.5 seconds of margin after the 1 second mark is to avoid
+ // flakiness.
// Note that awaiting moves us to a new task in the execution cycle,
// which allows the stats to change.
await new Promise((r) => step_timeout(r, 1500));
- assert_greater_than(stats.totalFramesDuration, 1000);
+ assert_greater_than(stats.totalFramesDuration, 900);
should_be_in_range(
stats.fallbackFramesDuration,
0,
@@ -105,9 +109,9 @@
assert_greater_than(stats.totalFramesDuration, 1000);
let beforeWait = stats.toJSON();
- // Synchronously wait 500 ms.
+ // Synchronously wait 1500 ms.
const start = performance.now();
- while (performance.now() - start < 500);
+ while (performance.now() - start < 1500);
// We are still in the same execution cycle, so the stats shouldn't
// have changed.