Index: LayoutTests/webaudio/resources/audiobuffersource-testing.js |
diff --git a/LayoutTests/webaudio/resources/audiobuffersource-testing.js b/LayoutTests/webaudio/resources/audiobuffersource-testing.js |
index 06e122e7baf8e222c02baacf9ca6fe66556cf625..ed8fa80e198ea1d7b48ad44db27b2dcabc212273 100644 |
--- a/LayoutTests/webaudio/resources/audiobuffersource-testing.js |
+++ b/LayoutTests/webaudio/resources/audiobuffersource-testing.js |
@@ -29,7 +29,15 @@ function checkSingleTest(renderedBuffer, i) { |
description += " with playbackRate of " + test.playbackRate; |
} |
- for (var j = 0; j < test.renderFrames; ++j) { |
+ var framesToTest; |
+ |
+ if (test.renderFrames) |
+ framesToTest = test.renderFrames; |
+ else if (test.durationFrames) |
+ framesToTest = test.durationFrames; |
+ |
+ // Verify that the output matches |
+ for (var j = 0; j < framesToTest; ++j) { |
if (expected[j] != renderedData[offsetFrame + j]) { |
// Copy from Float32Array to regular JavaScript array for error message. |
var renderedArray = new Array(); |
@@ -43,6 +51,21 @@ function checkSingleTest(renderedBuffer, i) { |
} |
} |
+ // Verify that we get all zeroes after the buffer (or duration) has passed. |
+ for (var j = framesToTest; j < testSpacingFrames; ++j) { |
+ if (renderedData[offsetFrame + j]) { |
+ // Copy from Float32Array to regular JavaScript array for error message. |
+ var renderedArray = new Array(); |
+ for (var j = framesToTest; j < testSpacingFrames; ++j) |
+ renderedArray[j - framesToTest] = renderedData[offsetFrame + j]; |
+ |
+ var s = description + ": expected: all zeroes actual: " + renderedArray; |
+ testFailed(s); |
+ success = false; |
+ break; |
+ } |
+ } |
+ |
if (success) |
testPassed(description); |