Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: third_party/WebKit/LayoutTests/webaudio/resources/oscillator-testing.js

Issue 2768773002: Revert of Allow status = 0 when XHR is completed in Audit.loadFileFromUrl(). (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,

Powered by Google App Engine
This is Rietveld 408576698