Skip to content

Commit 6a6a92e

Browse files
Raymond Toychromium-wpt-export-bot
Raymond Toy
authored andcommitted
Fix bug in audiobuffersource-duration-loop test
The test was producing a failure that the array lengths didn't match. (Not sure why the test was marked as passing even though it failed.) The problem was that we actually had audioBuffer.getChannelData instead of audioBuffer.getChannelData(0) to get the data from the first channel. Correct the mistake and also run clang-format over the code to clean it up. Bug: 1217791 Change-Id: I510838337e2948b89fb0622b63dd81e022d103d0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2945641 Reviewed-by: Hongchan Choi <hongchan@chromium.org> Commit-Queue: Raymond Toy <rtoy@chromium.org> Cr-Commit-Position: refs/heads/master@{#891341}
1 parent 7f913d9 commit 6a6a92e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-duration-loop.html

+8-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
// Create the sample buffer and fill the second half with 1
2020
let buffer = context.createBuffer(1, 2048, context.sampleRate);
21-
for(let i = 1024; i < 2048; i++) {
21+
for (let i = 1024; i < 2048; i++) {
2222
buffer.getChannelData(0)[i] = 1;
2323
}
2424

@@ -32,15 +32,17 @@
3232
source.start(0, 1024 / context.sampleRate, 2048 / context.sampleRate);
3333
// Expectations
3434
let expected = new Float32Array(4096);
35-
for(let i = 0; i < 2048; i++) {
35+
for (let i = 0; i < 2048; i++) {
3636
expected[i] = 1;
3737
}
3838
// Render it!
3939
context.startRendering()
40-
.then(function(audioBuffer) {
41-
should(audioBuffer.getChannelData, "audioBuffer.getChannelData").beEqualToArray(expected);
42-
})
43-
.then(task.done());
40+
.then(function(audioBuffer) {
41+
should(
42+
audioBuffer.getChannelData(0), 'audioBuffer.getChannelData')
43+
.beEqualToArray(expected);
44+
})
45+
.then(task.done());
4446
});
4547

4648
audit.run();

0 commit comments

Comments
 (0)