Skip to content

Commit 1010efa

Browse files
Muhammad Saqlainchromium-wpt-export-bot
authored andcommitted
[webaudio-testharness] Migrate audiobuffersource-null.html
Convert audiobuffersource-null.html from the legacy audit.js runner to pure testharness.js Bug: 396477778 Change-Id: Ie4d0e97df543758686796b27fb7665562b9fa3d1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7352260 Reviewed-by: Hongchan Choi <hongchan@chromium.org> Commit-Queue: Hongchan Choi <hongchan@chromium.org> Reviewed-by: Michael Wilson <mjwilson@chromium.org> Cr-Commit-Position: refs/heads/main@{#1651184}
1 parent 03a2457 commit 1010efa

1 file changed

Lines changed: 11 additions & 24 deletions

File tree

webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-null.html

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,11 @@
77
<script src="/resources/testharness.js"></script>
88
<script src="/resources/testharnessreport.js"></script>
99
<script src="/webaudio/resources/audit-util.js"></script>
10-
<script src="/webaudio/resources/audit.js"></script>
1110
</head>
1211

1312
<body>
1413
<script>
15-
const audit = Audit.createTaskRunner();
16-
17-
audit.define('ABSN with null buffer', (task, should) => {
14+
promise_test(async () => {
1815
// Create test context. Length and sampleRate are pretty arbitrary, but
1916
// we don't need either to be very large.
2017
const context = new OfflineAudioContext(
@@ -28,32 +25,22 @@
2825

2926
audioBuffer.getChannelData(0).fill(1);
3027

31-
// These two tests are mostly for the informational messages to show
32-
// what's happening. They should never fail!
33-
should(() => {
34-
audioBufferSourceNode.buffer = audioBuffer;
35-
}, 'Setting ABSN.buffer to AudioBuffer').notThrow();
28+
audioBufferSourceNode.buffer = audioBuffer;
3629

3730
// This is the important part. Setting the buffer to null after setting
3831
// it to something else should cause the source to produce silence.
39-
should(() => {
40-
audioBufferSourceNode.buffer = null;
41-
}, 'Setting ABSN.buffer = null').notThrow();
32+
audioBufferSourceNode.buffer = null;
4233

43-
audioBufferSourceNode.start(0);
34+
audioBufferSourceNode.start();
4435
audioBufferSourceNode.connect(context.destination);
4536

46-
context.startRendering()
47-
.then(buffer => {
48-
// Since the buffer is null, the output of the source should be
49-
// silence.
50-
should(buffer.getChannelData(0), 'ABSN output')
51-
.beConstantValueOf(0);
52-
})
53-
.then(() => task.done());
54-
});
55-
56-
audit.run();
37+
const renderedBuffer = await context.startRendering();
38+
39+
// Since the buffer is null, the output of the source should be
40+
// silence.
41+
const actual = renderedBuffer.getChannelData(0);
42+
assert_constant_value(actual, 0, 'ABSN output');
43+
}, 'ABSN with null buffer');
5744
</script>
5845
</body>
5946
</html>

0 commit comments

Comments
 (0)