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

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

Issue 1803233002: AnalyserNode should downmix channels to mono. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/realtimeanalyser-testing.js
diff --git a/third_party/WebKit/LayoutTests/webaudio/resources/realtimeanalyser-testing.js b/third_party/WebKit/LayoutTests/webaudio/resources/realtimeanalyser-testing.js
index 8b96e9859373ac1c35c69c7838f0dcdab0d512aa..fe651adb8606227f2b85ba2ea4288fc37b21c3bb 100644
--- a/third_party/WebKit/LayoutTests/webaudio/resources/realtimeanalyser-testing.js
+++ b/third_party/WebKit/LayoutTests/webaudio/resources/realtimeanalyser-testing.js
@@ -77,9 +77,11 @@ function clipMagnitude(limit, x) {
x[k] = Math.max(limit, x[k])
}
-// Compare the float frequency data in dB, |freqData|, against the expected
-// value, |expectedFreq|. |options| is a dictionary with the property
-// |floatRelError| for setting the comparison threshold.
+// Compare the float frequency data in dB, |freqData|, against the expected value,
+// |expectedFreq|. |options| is a dictionary with the property |floatRelError| for setting the
+// comparison threshold and |precision| for setting the printed precision. Setting |precision| to
+// |undefined| means printing all digits. If |options.precision} doesn't exist, use a default
+// precision.
function compareFloatFreq(message, freqData, expectedFreq, options) {
// Any dB values below -100 is pretty much in the noise due to round-off in
// the (single-precisiion) FFT, so just clip those values to -100.
@@ -89,9 +91,13 @@ function compareFloatFreq(message, freqData, expectedFreq, options) {
var actual = freqData;
clipMagnitude(lowerLimit, actual);
+ // Default precision for printing the FFT data. Distinguish between options.precision existing
+ // or not. If it does, use whatever value is there, including undefined.
+ var defaultPrecision = options.hasOwnProperty("precision") ? options.precision : 3;
+
var success = Should(message, actual, {
verbose: true,
- precision: 3
+ precision: defaultPrecision
})
.beCloseToArray(expectedFreq, {
relativeThreshold: options.floatRelError || 0,

Powered by Google App Engine
This is Rietveld 408576698