| Index: third_party/WebKit/LayoutTests/webaudio/resources/oscillator-testing.js
|
| diff --git a/third_party/WebKit/LayoutTests/webaudio/resources/oscillator-testing.js b/third_party/WebKit/LayoutTests/webaudio/resources/oscillator-testing.js
|
| index f2d8f9c0877b0d308fef596337c75589f29d7892..84543864681f079b5159231e48f68031c75d65d9 100644
|
| --- a/third_party/WebKit/LayoutTests/webaudio/resources/oscillator-testing.js
|
| +++ b/third_party/WebKit/LayoutTests/webaudio/resources/oscillator-testing.js
|
| @@ -42,6 +42,10 @@
|
|
|
| // Max diff must be less than this to pass the test.
|
| var thresholdDiff = 0;
|
| +
|
| +// Count the number of differences between the expected and actual result. The tests passes
|
| +// if the count is less than this threshold.
|
| +var thresholdDiffCount = 0;
|
|
|
| // Mostly for debugging
|
|
|
| @@ -119,6 +123,11 @@
|
| maxError = Math.abs(diff);
|
| errorPosition = k;
|
| }
|
| + // The reference file is a 16-bit WAV file, so we will almost never get an exact match
|
| + // between it and the actual floating-point result.
|
| + if (diff > 0) {
|
| + diffCount++;
|
| + }
|
| }
|
|
|
| var snr = calculateSNR(signalPower, noisePower);
|
| @@ -126,6 +135,11 @@
|
| .beGreaterThanOrEqualTo(thresholdSNR);
|
| should(maxError, "Maximum difference")
|
| .beLessThanOrEqualTo(thresholdDiff);
|
| +
|
| + should(diffCount,
|
| + "Number of differences between actual and expected result out of "
|
| + + renderedData.length + " frames")
|
| + .beLessThanOrEqualTo(thresholdDiffCount);
|
|
|
| var filename = "oscillator-" + oscType + "-actual.wav";
|
| if (downloadAudioBuffer(renderedBuffer, filename, true))
|
| @@ -147,6 +161,7 @@
|
| lengthInSeconds: lengthInSeconds,
|
| thresholdSNR: thresholdSNR,
|
| thresholdDiff: thresholdDiff,
|
| + thresholdDiffCount: thresholdDiffCount,
|
| waveScaleFactor: waveScaleFactor,
|
| setThresholds: setThresholds,
|
| runTest: runTest,
|
|
|