commit 412f7feb64ff579a5c890aaf904ea6e3010d9bfe
parent 04bc0fbffdc4bcfd363cd3e53d675fc677c12e06
Author: punithbnayak <punithbnayak@chromium.org>
Date: Mon, 8 Dec 2025 12:25:08 +0000
Bug 2001002 [wpt PR 56106] - [webaudio-testharness] Migrate retrospective-setValueAtTime.html, a=testonly
Automatic update from web-platform-tests
[webaudio-testharness] Migrate retrospective-setValueAtTime.html
Convert retrospective-setValueAtTime.html from the legacy
audit.js runner to pure testharness.js
Change-Id: I2468c9c7799b8d73c200ebd51b0820d3ce8f4c6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7135704
Commit-Queue: Punith Nayak <punithbnayak@chromium.org>
Reviewed-by: Michael Wilson <mjwilson@chromium.org>
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1554077}
--
wpt-commits: 76b9f8405f147c491227a25b7c8ee2f3c27e3d65
wpt-pr: 56106
Diffstat:
1 file changed, 46 insertions(+), 60 deletions(-)
diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime.html
@@ -5,70 +5,56 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webaudio/resources/audit-util.js"></script>
- <script src="/webaudio/resources/audit.js"></script>
<script src="retrospective-test.js"></script>
</head>
<body>
<script>
- let audit = Audit.createTaskRunner();
-
- audit.define(
- {
- label: 'test',
- description: 'Test setValueAtTime with startTime in the past'
- },
- (task, should) => {
- let {context, source, test, reference} = setupRetrospectiveGraph();
-
- // Suspend the context at this frame so we can synchronously set up
- // automations.
- const suspendFrame = 128;
-
- // Use a ramp of slope 1 per frame to measure time.
- // The end value is the extent of exact precision in single
- // precision float.
- const rampEnd = context.length - suspendFrame;
- const rampEndSeconds = context.length / context.sampleRate;
-
- context.suspend(suspendFrame / context.sampleRate)
- .then(() => {
- // Call setValueAtTime with a time in the past
- test.gain.setValueAtTime(0.0, 0.5 * context.currentTime);
- test.gain.linearRampToValueAtTime(rampEnd, rampEndSeconds);
-
- reference.gain.setValueAtTime(0.0, context.currentTime);
- reference.gain.linearRampToValueAtTime(
- rampEnd, rampEndSeconds);
- })
- .then(() => context.resume());
-
- source.start();
-
- context.startRendering()
- .then(resultBuffer => {
- let testValue = resultBuffer.getChannelData(0);
- let referenceValue = resultBuffer.getChannelData(1);
-
- // Until the suspendFrame, both should be exactly equal to 1.
- should(
- testValue.slice(0, suspendFrame),
- `Test[0:${suspendFrame - 1}]`)
- .beConstantValueOf(1);
- should(
- referenceValue.slice(0, suspendFrame),
- `Reference[0:${suspendFrame - 1}]`)
- .beConstantValueOf(1);
-
- // After the suspendFrame, both should be equal (and not
- // constant)
- should(
- testValue.slice(suspendFrame), `Test[${suspendFrame}:]`)
- .beEqualToArray(referenceValue.slice(suspendFrame));
- })
- .then(() => task.done());
- });
-
- audit.run();
+ // Test setValueAtTime with startTime in the past
+ promise_test(async () => {
+ const {context, source, test, reference} = setupRetrospectiveGraph();
+ // Suspend the context at this frame so we can synchronously set up
+ // automations.
+ const suspendFrame = 128;
+
+ // Use a ramp of slope 1 per frame to measure time.
+ // The end value is the extent of exact precision in single
+ // precision float.
+ const rampEnd = context.length - suspendFrame;
+ const rampEndSeconds = context.length / context.sampleRate;
+
+ context.suspend(suspendFrame / context.sampleRate)
+ .then(() => {
+ // Call setValueAtTime with a time in the past
+ test.gain.setValueAtTime(0.0, 0.5 * context.currentTime);
+ test.gain.linearRampToValueAtTime(rampEnd, rampEndSeconds);
+ reference.gain.setValueAtTime(0.0, context.currentTime);
+ reference.gain.linearRampToValueAtTime(
+ rampEnd, rampEndSeconds);
+ context.resume();
+ });
+
+ source.start();
+
+ const resultBuffer = await context.startRendering();
+ const actualChannelData = resultBuffer.getChannelData(0);
+ const expectedChannelData = resultBuffer.getChannelData(1);
+
+ // Until the suspendFrame, both should be exactly equal to 1.
+ assert_constant_value(
+ actualChannelData.slice(0, suspendFrame),
+ 1,
+ `Test[0:${suspendFrame - 1}]`);
+ assert_constant_value(
+ expectedChannelData.slice(0, suspendFrame),
+ 1,
+ `Reference[0:${suspendFrame - 1}]`);
+
+ // After the suspendFrame, both should be equal (and not constant)
+ assert_array_equals_exact(
+ actualChannelData.slice(suspendFrame),
+ expectedChannelData.slice(suspendFrame),
+ `Test[${suspendFrame}:]`);
+ }, 'Test setValueAtTime with startTime in the past');
</script>
</body>
</html>