tor-browser

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

commit 54605621f650808432befa720c935d7d30bcc249
parent ffef9a3a0bfc47d6fb04b8bc96213ae876180bb0
Author: punithbnayak <punithbnayak@chromium.org>
Date:   Fri,  3 Oct 2025 08:58:48 +0000

Bug 1990896 [wpt PR 55072] - [webaudio-testharness] Migrate active-processing.https.html, a=testonly

Automatic update from web-platform-tests
[webaudio-testharness] Migrate active-processing.https.html

Convert active-processing.https.html from the legacy
audit.js runner to pure testharness.js

Change-Id: I8831dc91774ee36cfe58294fc80a96a9e5b3b4f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6964658
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Commit-Queue: Punith Nayak <punithbnayak@chromium.org>
Reviewed-by: Michael Wilson <mjwilson@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1520890}

--

wpt-commits: 00cb0b9deaa15124079f16af15ab2f2ac4d2aff9
wpt-pr: 55072

Diffstat:
Mtesting/web-platform/tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https.html | 112++++++++++++++++++++++++++++++++++++++-----------------------------------------
1 file changed, 54 insertions(+), 58 deletions(-)

diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https.html b/testing/web-platform/tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https.html @@ -6,36 +6,31 @@ </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> </head> <body> - <script id="layout-test-code"> - // AudioProcessor that sends a message to its AudioWorkletNode whenver the - // number of channels on its input changes. - let filePath = + <script> + // AudioProcessor that sends a message to its AudioWorkletNode + // whenever the number of channels on its input changes. + const filePath = '../the-audioworklet-interface/processors/active-processing.js'; - const audit = Audit.createTaskRunner(); - let context; - audit.define('initialize', (task, should) => { + promise_test(async () => { // Create context and load the module context = new AudioContext(); - should( - context.audioWorklet.addModule(filePath), - 'AudioWorklet module loading') - .beResolved() - .then(() => task.done()); - }); + await context.audioWorklet.addModule(filePath); + }, 'AudioWorklet module should load successfully'); - audit.define('test', (task, should) => { + promise_test(async () => { const src = new OscillatorNode(context); - const response = new AudioBuffer({numberOfChannels: 2, length: 150, - sampleRate: context.sampleRate}); + const response = new AudioBuffer({ + numberOfChannels: 2, + length: 150, + sampleRate: context.sampleRate + }); const conv = new ConvolverNode(context, {buffer: response}); @@ -43,51 +38,52 @@ new AudioWorkletNode(context, 'active-processing-tester', { // Use as short a duration as possible to keep the test from // taking too much time. - processorOptions: {testDuration: .5}, + processorOptions: {testDuration: 0.5}, }); - // Expected number of output channels from the convolver node. We should - // start with the number of inputs, because the source (oscillator) is - // actively processing. When the source stops, the number of channels - // should change to 0. + // Expected number of output channels from the convolver node. + // We should start with the number of inputs, because the + // source (oscillator) is actively processing. When the source + // stops, the number of channels should change to 0. const expectedValues = [2, 0]; let index = 0; - testerNode.port.onmessage = event => { - let count = event.data.channelCount; - let finished = event.data.finished; - - // If we're finished, end testing. - if (finished) { - // Verify that we got the expected number of changes. - should(index, 'Number of distinct values') - .beEqualTo(expectedValues.length); - - task.done(); - return; - } - - if (index < expectedValues.length) { - // Verify that the number of channels matches the expected number of - // channels. - should(count, `Test ${index}: Number of convolver output channels`) - .beEqualTo(expectedValues[index]); - } - - ++index; - }; - - // Create the graph and go - src.connect(conv).connect(testerNode).connect(context.destination); - src.start(); - - // Stop the source after a short time so we can test that the convolver - // changes to not actively processing and thus produces a single channel - // of silence. - src.stop(context.currentTime + .1); - }); - - audit.run(); + return new Promise(resolve => { + testerNode.port.onmessage = event => { + const count = event.data.channelCount; + const finished = event.data.finished; + + // If we're finished, end testing. + if (finished) { + // Verify that we got the expected number of changes. + assert_equals( + index, expectedValues.length, + 'Number of distinct values'); + resolve(); + return; + } + + if (index < expectedValues.length) { + // Verify that the number of channels matches the expected + // number of channels. + assert_equals( + count, expectedValues[index], + `Test ${index}: Number of convolver output channels`); + } + + ++index; + }; + + // Create the graph and go + src.connect(conv).connect(testerNode).connect(context.destination); + src.start(); + + // Stop the source after a short time so we can test that the + // convolver changes to not actively processing and thus + // produces a single channel of silence. + src.stop(context.currentTime + 0.1); + }); + }, 'ConvolverNode should stop active processing after source stops'); </script> </body> </html>