commit 37698d3f7eaac45bbd126f980c0ea6037d7a6798
parent 3975703baa17a6a66206fd2500221886ab41cf45
Author: punithbnayak <punithbnayak@chromium.org>
Date: Mon, 10 Nov 2025 22:20:06 +0000
Bug 1999004 [wpt PR 55947] - [webaudio-testharness] Migrate audionode-connect-order.html, a=testonly
Automatic update from web-platform-tests
[webaudio-testharness] Migrate audionode-connect-order.html
Convert audionode-connect-order.html from the legacy
audit.js runner to pure testharness.js
Change-Id: Ifcd2b136c96e632e86fa26dbbf616c8fe2e895fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7104798
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Reviewed-by: Dibyajyoti Pal <dibyapal@chromium.org>
Commit-Queue: Punith Nayak <punithbnayak@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1541919}
--
wpt-commits: 836ea9ea3decebd361a677cf5511682268439efc
wpt-pr: 55947
Diffstat:
1 file changed, 37 insertions(+), 50 deletions(-)
diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/audionode-connect-order.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/audionode-connect-order.html
@@ -2,76 +2,63 @@
<html>
<head>
<title>
- audionode-connect-order.html
+ AudioNode: Connection Order Robustness
</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">
- let audit = Audit.createTaskRunner();
- let sampleRate = 44100.0;
- let renderLengthSeconds = 0.125;
- let delayTimeSeconds = 0.1;
+ <script>
+ const sampleRate = 44100.0;
+ const renderLengthSeconds = 0.125;
+ const delayTimeSeconds = 0.1;
- function createSinWaveBuffer(context, lengthInSeconds, frequency) {
- let audioBuffer =
- context.createBuffer(1, lengthInSeconds * sampleRate, sampleRate);
+ const createSinWaveBuffer = (lengthInSeconds, frequency) => {
+ const audioBuffer = new AudioBuffer({
+ numberOfChannels: 1,
+ length: Math.floor(lengthInSeconds * sampleRate),
+ sampleRate
+ });
- let n = audioBuffer.length;
- let data = audioBuffer.getChannelData(0);
+ let channelData = audioBuffer.getChannelData(0);
- for (let i = 0; i < n; ++i) {
- data[i] = Math.sin(frequency * 2 * Math.PI * i / sampleRate);
+ for (let i = 0; i < audioBuffer.length; ++i) {
+ channelData[i] = Math.sin(frequency * 2 * Math.PI * i / sampleRate);
}
return audioBuffer;
}
- audit.define(
- {
- label: 'Test connections',
- description:
- 'AudioNode connection order doesn\'t trigger assertion errors'
- },
- function(task, should) {
- // Create offline audio context.
- let context = new OfflineAudioContext(
- 1, sampleRate * renderLengthSeconds, sampleRate);
- let toneBuffer =
- createSinWaveBuffer(context, renderLengthSeconds, 880);
+ promise_test(async () => {
+ const context = new OfflineAudioContext(
+ 1, sampleRate * renderLengthSeconds, sampleRate);
- let bufferSource = context.createBufferSource();
- bufferSource.buffer = toneBuffer;
- bufferSource.connect(context.destination);
+ const bufferSource = new AudioBufferSourceNode(context, {
+ buffer: createSinWaveBuffer(renderLengthSeconds, 880)
+ });
+ bufferSource.connect(context.destination);
- let delay = context.createDelay();
- delay.delayTime.value = delayTimeSeconds;
+ const delay = new DelayNode(context, {
+ delayTime: delayTimeSeconds
+ });
- // We connect delay node to gain node before anything is connected
- // to delay node itself. We do this because we try to trigger the
- // ASSERT which might be fired due to AudioNode connection order,
- // especially when gain node and delay node is involved e.g.
- // https://bugs.webkit.org/show_bug.cgi?id=76685.
+ // We connect delay node to gain node before anything is connected
+ // to delay node itself. We do this because we try to trigger the
+ // ASSERT which might be fired due to AudioNode connection order,
+ // especially when gain node and delay node is involved e.g.
+ // https://bugs.webkit.org/show_bug.cgi?id=76685.
- should(() => {
- let gain = context.createGain();
- gain.connect(context.destination);
- delay.connect(gain);
- }, 'Connecting nodes').notThrow();
+ // This should not throw an exception.
+ const gain = new GainNode(context);
+ gain.connect(context.destination);
+ delay.connect(gain);
- bufferSource.start(0);
+ bufferSource.start();
- let promise = context.startRendering();
-
- should(promise, 'OfflineContext startRendering()')
- .beResolved()
- .then(task.done.bind(task));
- });
-
- audit.run();
+ await context.startRendering();
+ }, `Test connections: AudioNode connection order doesn't `+
+ `trigger assertion errors`);
</script>
</body>
</html>