tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 1bc05351ce9181ee56c9b254939632694d9c33d1
parent a033876d0f870e299aad35f653203911bb70e7de
Author: Saqlain <2mesaqlain@gmail.com>
Date:   Thu,  9 Oct 2025 16:28:39 +0000

Bug 1991170 [wpt PR 55110] - [webaudio-testharness] Migrate retrospective-setTargetAtTime.html, a=testonly

Automatic update from web-platform-tests
[webaudio-testharness] Migrate retrospective-setTargetAtTime.html

Convert retrospective-setTargetAtTime.html from the legacy audit.js
runner to pure testharness.js

Bug: 396477778
Change-Id: Id3762a7109c0d2e2747d23943ea9cc4cabb61af3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6964971
Reviewed-by: Michael Wilson <mjwilson@chromium.org>
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Commit-Queue: Saqlain <2mesaqlain@gmail.com>
Cr-Commit-Position: refs/heads/main@{#1521533}

--

wpt-commits: 97ac0da0369fa31119e53a105d7d00e43484e31f
wpt-pr: 55110

Diffstat:
Mtesting/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setTargetAtTime.html | 123++++++++++++++++++++++++++++++++++---------------------------------------------
1 file changed, 53 insertions(+), 70 deletions(-)

diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setTargetAtTime.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setTargetAtTime.html @@ -1,80 +1,63 @@ -<!doctype html> +<!DOCTYPE html> <meta charset=utf-8> <html> <head> <title>Test setTargetAtTime with start time in the past</title> - <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="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> </head> <body> <script> - let audit = Audit.createTaskRunner(); - - audit.define( - { - label: 'test', - description: 'Test setTargetAtTime with start time in the past' - }, - (task, should) => { - // Use a sample rate that is a power of two to eliminate round-off - // in computing the currentTime. - let context = new OfflineAudioContext(2, 16384, 16384); - let source = new ConstantSourceNode(context); - - // Suspend the context at this frame so we can synchronously set up - // automations. - const suspendFrame = 128; - - let test = new GainNode(context); - let reference = new GainNode(context); - - source.connect(test); - source.connect(reference); - - let merger = new ChannelMergerNode( - context, {numberOfInputs: context.destination.channelCount}); - test.connect(merger, 0, 0); - reference.connect(merger, 0, 1); - - merger.connect(context.destination); - - context.suspend(suspendFrame / context.sampleRate) - .then(() => { - // Call setTargetAtTime with a time in the past - test.gain.setTargetAtTime(0.1, 0.5*context.currentTime, 0.1); - reference.gain.setTargetAtTime(0.1, context.currentTime, 0.1); - }) - .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(); + const suspendFrame = 128; + + promise_test(async () => { + // Use a sample rate that is a power of two to eliminate round-off + // in computing the currentTime. + const context = new OfflineAudioContext(2, 16384, 16384); + const source = new ConstantSourceNode(context); + + const test = new GainNode(context); + const reference = new GainNode(context); + + source.connect(test); + source.connect(reference); + + const merger = new ChannelMergerNode( + context, {numberOfInputs: context.destination.channelCount}); + test.connect(merger, 0, 0); + reference.connect(merger, 0, 1); + + merger.connect(context.destination); + + context.suspend(suspendFrame / context.sampleRate).then(() => { + // Call setTargetAtTime with a time in the past + test.gain.setTargetAtTime(0.1, 0.5*context.currentTime, 0.1); + reference.gain.setTargetAtTime(0.1, context.currentTime, 0.1); + context.resume(); + }); + + source.start(); + + const resultBuffer = await context.startRendering(); + const testValue = resultBuffer.getChannelData(0); + const referenceValue = resultBuffer.getChannelData(1); + + // Until the suspendFrame, both should be exactly equal to 1. + assert_array_equals( + testValue.slice(0, suspendFrame), + new Float32Array(suspendFrame).fill(1), + `Test[0:${suspendFrame - 1}]`); + assert_array_equals( + referenceValue.slice(0, suspendFrame), + new Float32Array(suspendFrame).fill(1), + `Reference[0:${suspendFrame - 1}]`); + + // After the suspendFrame, both should be equal (and not constant) + assert_array_equals( + testValue.slice(suspendFrame), + referenceValue.slice(suspendFrame), + `Test[${suspendFrame}:]`); + }, 'Test setTargetAtTime with start time in the past'); </script> </body> </html>