tor-browser

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

commit 556fbb28777facf1f68083fc94c79b97bb419407
parent 7b902bdfbe0dfa1376afe13f35c44e624213addb
Author: Saqlain <2mesaqlain@gmail.com>
Date:   Thu,  9 Oct 2025 20:34:31 +0000

Bug 1992193 [wpt PR 55186] - [webaudio-testharness] Migrate set-target-conv.html, a=testonly

Automatic update from web-platform-tests
[webaudio-testharness] Migrate set-target-conv.html

Convert third_party/blink/web_tests/external/wpt/webaudio
/the-audio-api/the-audioparam-interface/set-target-conv.html from the
legacy audit.js runner to pure testharness.js

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

--

wpt-commits: 2cc8470b689fd1a9131c39bf93c84d7321c65358
wpt-pr: 55186

Diffstat:
Mtesting/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/set-target-conv.html | 119+++++++++++++++++++++++++++++++++++--------------------------------------------
1 file changed, 52 insertions(+), 67 deletions(-)

diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/set-target-conv.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/set-target-conv.html @@ -1,93 +1,78 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<!DOCTYPE html> <html> <head> <title>Test convergence of setTargetAtTime</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> - <script src="/webaudio/resources/audit.js"></script> <script src='/webaudio/resources/audio-param.js'></script> + <script src="/webaudio/resources/audit-util.js"></script> </head> <body> <script> - let audit = Audit.createTaskRunner(); + promise_test(async () => { + // Two channels: + // 0 - actual result + // 1 - expected result + const context = new OfflineAudioContext( + {numberOfChannels: 2, sampleRate: 8000, length: 8000}); - audit.define( - {task: 'setTargetAtTime', label: 'convergence handled correctly'}, - (task, should) => { - // Two channels: - // 0 - actual result - // 1 - expected result - const context = new OfflineAudioContext( - {numberOfChannels: 2, sampleRate: 8000, length: 8000}); + const merger = new ChannelMergerNode( + context, {numberOfChannels: context.destination.channelCount}); + merger.connect(context.destination); - const merger = new ChannelMergerNode( - context, {numberOfChannels: context.destination.channelCount}); - merger.connect(context.destination); + // Construct test source that will have the AudioParams being tested + // to verify that the AudioParams are working correctly. + const src = new ConstantSourceNode(context); - // Construct test source that will have tha AudioParams being tested - // to verify that the AudioParams are working correctly. - let src; + src.connect(merger, 0, 0); + src.offset.setValueAtTime(1, 0); - should( - () => src = new ConstantSourceNode(context), - 'src = new ConstantSourceNode(context)') - .notThrow(); + const timeConstant = 0.01; - src.connect(merger, 0, 0); - src.offset.setValueAtTime(1, 0); + // testTime must be at least 10*timeConstant. Also, this must not + // lie on a render boundary. + const testTime = 0.15; + const rampEnd = testTime + 0.001; - const timeConstant = 0.01; + src.offset.setTargetAtTime(0.5, 0.01, timeConstant); + src.offset.setValueAtTime(0.5, testTime); + src.offset.linearRampToValueAtTime(1, rampEnd); - // testTime must be at least 10*timeConstant. Also, this must not - // lie on a render boundary. - const testTime = 0.15; - const rampEnd = testTime + 0.001; + // The reference node that will generate the expected output. We do + // the same automations, except we don't apply the setTarget + // automation. + const refSrc = new ConstantSourceNode(context); + refSrc.connect(merger, 0, 1); - should( - () => src.offset.setTargetAtTime(0.5, 0.01, timeConstant), - `src.offset.setTargetAtTime(0.5, 0.01, ${timeConstant})`) - .notThrow(); - should( - () => src.offset.setValueAtTime(0.5, testTime), - `src.offset.setValueAtTime(0.5, ${testTime})`) - .notThrow(); - should( - () => src.offset.linearRampToValueAtTime(1, rampEnd), - `src.offset.linearRampToValueAtTime(1, ${rampEnd})`) - .notThrow(); + refSrc.offset.setValueAtTime(0.5, 0); + refSrc.offset.setValueAtTime(0.5, testTime); + refSrc.offset.linearRampToValueAtTime(1, rampEnd); - // The reference node that will generate the expected output. We do - // the same automations, except we don't apply the setTarget - // automation. - const refSrc = new ConstantSourceNode(context); - refSrc.connect(merger, 0, 1); + src.start(); + refSrc.start(); - refSrc.offset.setValueAtTime(0.5, 0); - refSrc.offset.setValueAtTime(0.5, testTime); - refSrc.offset.linearRampToValueAtTime(1, rampEnd); + const resultBuffer = await context.startRendering(); + const actual = resultBuffer.getChannelData(0); + const expected = resultBuffer.getChannelData(1); - src.start(); - refSrc.start(); + // Just verify that the actual output matches the expected + // starting a little bit before testTime. + const testFrame = Math.floor(testTime * context.sampleRate) - 128; + const actualSlice = actual.slice(testFrame); + const expectedSlice = expected.slice(testFrame); - context.startRendering() - .then(audio => { - const actual = audio.getChannelData(0); - const expected = audio.getChannelData(1); + assert_equals( + actualSlice.length, expectedSlice.length, + `output[${testFrame}:] length`); - // Just verify that the actual output matches the expected - // starting a little bit before testTime. - let testFrame = - Math.floor(testTime * context.sampleRate) - 128; - should(actual.slice(testFrame), `output[${testFrame}:]`) - .beCloseToArray( - expected.slice(testFrame), - {relativeThreshold: 4.1724e-6}); - }) - .then(() => task.done()); - }); - - audit.run(); + const relThreshold = 4.1724e-6; + assert_array_equal_within_eps( + actualSlice, + expectedSlice, + relThreshold, + `output[${testFrame}] approx expected (rel ${relThreshold})`); + }, 'setTargetAtTime: convergence handled correctly'); </script> </body> </html>