Skip to content

Commit 9f38cee

Browse files
committed
Bug 1979491 [wpt PR 53989] - [webaudio-testharness] Migrate biquad-basic.html, a=testonly
Automatic update from web-platform-tests [webaudio-testharness] Migrate biquad-basic.html This CL replaces the use of audit.js with testharness.js in the basic BiquadFilterNode properties test. The logic and structure of the original test are preserved, including all assertions and comments. Bug: 396477778 Change-Id: I751448ad603f60060cc3b5c903bf1b35c3e010ee Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6720942 Reviewed-by: Michael Wilson <mjwilsonchromium.org> Reviewed-by: Hongchan Choi <hongchanchromium.org> Commit-Queue: Punith Nayak <punithbnayakchromium.org> Cr-Commit-Position: refs/heads/main{#1492396} -- wpt-commits: d6c45114b4d5ef791473b6880e406429e9570269 wpt-pr: 53989 UltraBlame original commit: a468ba1834d16bd9b0c5eb7a46f6b2bcbab9c250
1 parent 4a0c2d6 commit 9f38cee

File tree

1 file changed

+63
-111
lines changed
  • testing/web-platform/tests/webaudio/the-audio-api/the-biquadfilternode-interface

1 file changed

+63
-111
lines changed

testing/web-platform/tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic.html

Lines changed: 63 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -6,129 +6,81 @@
66
</title>
77
<script src="/resources/testharness.js"></script>
88
<script src="/resources/testharnessreport.js"></script>
9-
<script src="/webaudio/resources/audit-util.js"></script>
10-
<script src="/webaudio/resources/audit.js"></script>
119
</head>
1210
<body>
13-
<script id="layout-test-code">
14-
let sampleRate = 48000;
15-
let testFrames = 100;
11+
<script>
12+
const sampleRate = 48000;
13+
const testFrames = 100;
1614

17-
// Global context that can be used by the individual tasks. It must be
18-
// defined by the initialize task.
19-
let context;
15+
// Global context that can be used by the individual tests.
16+
const context = new OfflineAudioContext(1, testFrames, sampleRate);
2017

21-
let audit = Audit.createTaskRunner();
18+
test(t => {
19+
// If construction threw, the test would fail automatically.
20+
assert_true(context instanceof OfflineAudioContext,
21+
'context should be an OfflineAudioContext');
22+
}, 'initialize');
2223

23-
audit.define('initialize', (task, should) => {
24-
should(() => {
25-
context = new OfflineAudioContext(1, testFrames, sampleRate);
26-
}, 'Initialize context for testing').notThrow();
27-
task.done();
28-
});
24+
test(t => {
25+
assert_true('createBiquadFilter' in context,
26+
'context.createBiquadFilter should exist');
27+
}, 'existence');
2928

30-
audit.define('existence', (task, should) => {
31-
should(context.createBiquadFilter, 'context.createBiquadFilter')
32-
.exist();
33-
task.done();
34-
});
35-
36-
audit.define('parameters', (task, should) => {
29+
test(t => {
3730
// Create a really simple IIR filter. Doesn't much matter what.
38-
let coef = Float32Array.from([1]);
39-
40-
let f = context.createBiquadFilter(coef, coef);
41-
42-
should(f.numberOfInputs, 'numberOfInputs').beEqualTo(1);
43-
should(f.numberOfOutputs, 'numberOfOutputs').beEqualTo(1);
44-
should(f.channelCountMode, 'channelCountMode').beEqualTo('max');
45-
should(f.channelInterpretation, 'channelInterpretation')
46-
.beEqualTo('speakers');
31+
const coef = Float32Array.from([1]);
4732

48-
task.done();
49-
});
33+
const f = context.createBiquadFilter(coef, coef);
5034

51-
audit.define('exceptions-createBiquadFilter', (task, should) => {
52-
should(function() {
53-
// Two args are required.
54-
context.createBiquadFilter();
55-
}, 'createBiquadFilter()').notThrow();
35+
assert_equals(f.numberOfInputs, 1, 'numberOfInputs');
36+
assert_equals(f.numberOfOutputs, 1, 'numberOfOutputs');
37+
assert_equals(f.channelCountMode, 'max', 'channelCountMode');
38+
assert_equals(f.channelInterpretation, 'speakers',
39+
'channelInterpretation');
40+
}, 'parameters');
5641

57-
task.done();
58-
});
42+
test(t => {
43+
// Two args are required. Should _not_ throw.
44+
context.createBiquadFilter();
45+
}, 'exceptions-createBiquadFilter');
5946

60-
audit.define('exceptions-getFrequencyData', (task, should) => {
47+
test(t => {
6148
// Create a really simple IIR filter. Doesn't much matter what.
62-
let coef = Float32Array.from([1]);
63-
64-
let f = context.createBiquadFilter(coef, coef);
65-
66-
should(
67-
function() {
68-
// frequencyHz can't be null.
69-
f.getFrequencyResponse(
70-
null, new Float32Array(1), new Float32Array(1));
71-
},
72-
'getFrequencyResponse(' +
73-
'null, ' +
74-
'new Float32Array(1), ' +
75-
'new Float32Array(1))')
76-
.throw(TypeError);
77-
78-
should(
79-
function() {
80-
// magResponse can't be null.
81-
f.getFrequencyResponse(
82-
new Float32Array(1), null, new Float32Array(1));
83-
},
84-
'getFrequencyResponse(' +
85-
'new Float32Array(1), ' +
86-
'null, ' +
87-
'new Float32Array(1))')
88-
.throw(TypeError);
89-
90-
should(
91-
function() {
92-
// phaseResponse can't be null.
93-
f.getFrequencyResponse(
94-
new Float32Array(1), new Float32Array(1), null);
95-
},
96-
'getFrequencyResponse(' +
97-
'new Float32Array(1), ' +
98-
'new Float32Array(1), ' +
99-
'null)')
100-
.throw(TypeError);
101-
102-
should(
103-
function() {
104-
// magResponse array must the same length as frequencyHz
105-
f.getFrequencyResponse(
106-
new Float32Array(10), new Float32Array(1),
107-
new Float32Array(20));
108-
},
109-
'getFrequencyResponse(' +
110-
'new Float32Array(10), ' +
111-
'new Float32Array(1), ' +
112-
'new Float32Array(20))')
113-
.throw(DOMException, 'InvalidAccessError');
114-
115-
should(
116-
function() {
117-
// phaseResponse array must be the same length as frequencyHz
118-
f.getFrequencyResponse(
119-
new Float32Array(10), new Float32Array(20),
120-
new Float32Array(1));
121-
},
122-
'getFrequencyResponse(' +
123-
'new Float32Array(10), ' +
124-
'new Float32Array(20), ' +
125-
'new Float32Array(1))')
126-
.throw(DOMException, 'InvalidAccessError');
127-
128-
task.done();
129-
});
130-
131-
audit.run();
49+
const coef = Float32Array.from([1]);
50+
const f = context.createBiquadFilter(coef, coef);
51+
52+
// frequencyHz can't be null.
53+
assert_throws_js(TypeError, () => {
54+
f.getFrequencyResponse(
55+
null, new Float32Array(1), new Float32Array(1));
56+
}, 'frequencyHz is null');
57+
58+
// magResponse can't be null.
59+
assert_throws_js(TypeError, () => {
60+
f.getFrequencyResponse(
61+
new Float32Array(1), null, new Float32Array(1));
62+
}, 'magResponse is null');
63+
64+
// phaseResponse can't be null.
65+
assert_throws_js(TypeError, () => {
66+
f.getFrequencyResponse(
67+
new Float32Array(1), new Float32Array(1), null);
68+
}, 'phaseResponse is null');
69+
70+
// magResponse array must be the same length as frequencyHz
71+
assert_throws_dom('InvalidAccessError', () => {
72+
f.getFrequencyResponse(
73+
new Float32Array(10), new Float32Array(1),
74+
new Float32Array(20));
75+
}, 'magResponse length mismatch');
76+
77+
// phaseResponse array must be the same length as frequencyHz
78+
assert_throws_dom('InvalidAccessError', () => {
79+
f.getFrequencyResponse(
80+
new Float32Array(10), new Float32Array(20),
81+
new Float32Array(1));
82+
}, 'phaseResponse length mismatch');
83+
}, 'exceptions-getFrequencyData');
13284
</script>
13385
</body>
13486
</html>

0 commit comments

Comments
 (0)