commit 25fcb93cb4f00be4168523a106ebb46f5de05d8e
parent 293aa5b6b9e387875a3fd8751ebd20fdfaecd7c9
Author: punithbnayak <punithbnayak@chromium.org>
Date: Fri, 3 Oct 2025 08:58:41 +0000
Bug 1990893 [wpt PR 55070] - [webaudio-testharness] Migrate nan-param.html, a=testonly
Automatic update from web-platform-tests
[webaudio-testharness] Migrate nan-param.html
Convert nan-param.html from the legacy
audit.js runner to pure testharness.js
Change-Id: Ib60e2ad0b2ca1e0e0e1949d6134515e78220d260
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6967206
Reviewed-by: Michael Wilson <mjwilson@chromium.org>
Commit-Queue: Punith Nayak <punithbnayak@chromium.org>
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1520885}
--
wpt-commits: 9a1873b9360d554f3bd84db89c1dab6b243bf031
wpt-pr: 55070
Diffstat:
1 file changed, 16 insertions(+), 21 deletions(-)
diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/nan-param.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/nan-param.html
@@ -5,37 +5,35 @@
<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>
- let audit = Audit.createTaskRunner();
-
// See
// https://webaudio.github.io/web-audio-api/#computation-of-value.
//
// The computed value must replace NaN values in the output with
// the default value of the param.
- audit.define('AudioParam NaN', async (task, should) => {
+ promise_test(async () => {
// For testing, we only need a small number of frames; and
// a low sample rate is perfectly fine. Use two channels.
// The first channel is for the AudioParam output. The
// second channel is for the AudioParam input.
- let context = new OfflineAudioContext(
+ const context = new OfflineAudioContext(
{numberOfChannels: 2, length: 256, sampleRate: 8192});
- let merger = new ChannelMergerNode(
+
+ const merger = new ChannelMergerNode(
context, {numberOfInputs: context.destination.channelCount});
merger.connect(context.destination);
// A constant source with a huge value.
- let mod = new ConstantSourceNode(context, {offset: 1e30});
+ const mod = new ConstantSourceNode(context, {offset: 1e30});
// Gain nodes with a huge positive gain and huge negative
// gain. Combined with the huge offset in |mod|, the
// output of the gain nodes are +Infinity and -Infinity.
- let gainPos = new GainNode(context, {gain: 1e30});
- let gainNeg = new GainNode(context, {gain: -1e30});
+ const gainPos = new GainNode(context, {gain: 1e30});
+ const gainNeg = new GainNode(context, {gain: -1e30});
mod.connect(gainPos);
mod.connect(gainNeg);
@@ -49,7 +47,7 @@
// that produces NaN values. Use a non-default value offset
// just in case something is wrong we get default for some
// other reason.
- let src = new ConstantSourceNode(context, {offset: 100});
+ const src = new ConstantSourceNode(context, {offset: 100});
gainPos.connect(src.offset);
gainNeg.connect(src.offset);
@@ -61,10 +59,10 @@
mod.start();
src.start();
- let buffer = await context.startRendering();
+ const buffer = await context.startRendering();
- let input = buffer.getChannelData(1);
- let output = buffer.getChannelData(0);
+ const input = buffer.getChannelData(1);
+ const output = buffer.getChannelData(0);
// Have to test manually for NaN values in the input because
// NaN fails all comparisons.
@@ -76,17 +74,14 @@
}
}
- should(isNaN, 'AudioParam input contains only NaN').beTrue();
+ assert_true(isNaN, 'AudioParam input contains only NaN');
// Output of the AudioParam should have all NaN values
// replaced by the default.
- should(output, 'AudioParam output')
- .beConstantValueOf(src.offset.defaultValue);
-
- task.done();
- });
-
- audit.run();
+ assert_constant_value(
+ output, src.offset.defaultValue,
+ 'AudioParam output should flush NaN to default');
+ }, 'AudioParam NaN should be flushed to default value');
</script>
</body>
</html>