commit 30881b78662beb1a0d045057a61a3a65b40e5fed
parent 7b4958149d96e2bf42a815262d0606a4cd420672
Author: punithbnayak <punithbnayak@chromium.org>
Date: Thu, 6 Nov 2025 21:37:27 +0000
Bug 1997731 [wpt PR 55808] - [webaudio-testharness] Migrate ctor-gain.html, a=testonly
Automatic update from web-platform-tests
[webaudio-testharness] Migrate ctor-gain.html
Convert ctor-gain.html from the legacy
audit.js runner to pure testharness.js
Change-Id: I6028b45cf4d8bd83c7cfdab11862c675226de4ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7093496
Commit-Queue: Punith Nayak <punithbnayak@chromium.org>
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Reviewed-by: Michael Wilson <mjwilson@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1539486}
--
wpt-commits: 7be91b03e0ad7a46a298a7d8f30d2a3e90d7d565
wpt-pr: 55808
Diffstat:
1 file changed, 31 insertions(+), 56 deletions(-)
diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-gainnode-interface/ctor-gain.html b/testing/web-platform/tests/webaudio/the-audio-api/the-gainnode-interface/ctor-gain.html
@@ -6,30 +6,20 @@
</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="/webaudio/resources/audionodeoptions.js"></script>
</head>
<body>
- <script id="layout-test-code">
- let context;
+ <script>
+ const context = new AudioContext();
- let audit = Audit.createTaskRunner();
+ test(() => {
+ testInvalidConstructor_W3CTH('GainNode', context);
+ }, 'GainNode: invalid constructor');
- audit.define('initialize', (task, should) => {
- context = initializeContext(should);
- task.done();
- });
-
- audit.define('invalid constructor', (task, should) => {
- testInvalidConstructor(should, 'GainNode', context);
- task.done();
- });
-
- audit.define('default constructor', (task, should) => {
- let prefix = 'node0';
- let node = testDefaultConstructor(should, 'GainNode', context, {
- prefix: prefix,
+ test(() => {
+ const prefix = 'node0';
+ const node = testDefaultConstructor_W3CTH('GainNode', context, {
+ prefix,
numberOfInputs: 1,
numberOfOutputs: 1,
channelCount: 2,
@@ -37,43 +27,28 @@
channelInterpretation: 'speakers'
});
- testDefaultAttributes(should, node, prefix, [{name: 'gain', value: 1}]);
-
- task.done();
- });
-
- audit.define('test AudioNodeOptions', (task, should) => {
- testAudioNodeOptions(should, context, 'GainNode');
- task.done();
- });
-
- audit.define('constructor with options', (task, should) => {
- let node;
- let options = {
- gain: -2,
- };
-
- should(
- () => {
- node = new GainNode(context, options);
- },
- 'node1 = new GainNode(c, ' + JSON.stringify(options) + ')')
- .notThrow();
- should(node instanceof GainNode, 'node1 instanceof GainNode')
- .beEqualTo(true);
-
- should(node.gain.value, 'node1.gain.value').beEqualTo(options.gain);
-
- should(node.channelCount, 'node1.channelCount').beEqualTo(2);
- should(node.channelCountMode, 'node1.channelCountMode')
- .beEqualTo('max');
- should(node.channelInterpretation, 'node1.channelInterpretation')
- .beEqualTo('speakers');
-
- task.done();
- });
-
- audit.run();
+ testDefaultAttributes_W3CTH(
+ node,
+ prefix,
+ [{ name: 'gain', value: 1 }]);
+ }, 'GainNode: default constructor and default attributes');
+
+ test(() => {
+ testAudioNodeOptions_W3CTH(context, 'GainNode');
+ }, 'GainNode: AudioNodeOptions are applied');
+
+ test(() => {
+ const options = { gain: -2 };
+ const node = new GainNode(context, options);
+ assert_true(node instanceof GainNode, 'instanceof GainNode');
+ assert_equals(node.gain.value, options.gain, 'node.gain.value');
+ assert_equals(node.channelCount, 2, 'node.channelCount');
+ assert_equals(node.channelCountMode, 'max', 'node.channelCountMode');
+ assert_equals(
+ node.channelInterpretation,
+ 'speakers',
+ 'node.channelInterpretation');
+ }, 'GainNode: constructor with options');
</script>
</body>
</html>