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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/resources/audit-util.js

Issue 2783553002: Convert AudioBufferSource tests to new Audit (Closed)
Patch Set: Indent neatly. Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiosource-time-limits.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/webaudio/resources/audit-util.js
diff --git a/third_party/WebKit/LayoutTests/webaudio/resources/audit-util.js b/third_party/WebKit/LayoutTests/webaudio/resources/audit-util.js
index 8c837667b3713b9cb5f7844b03bbecf6cace448a..389a2e7476c325bbc1cefc2386a39db384735013 100644
--- a/third_party/WebKit/LayoutTests/webaudio/resources/audit-util.js
+++ b/third_party/WebKit/LayoutTests/webaudio/resources/audit-util.js
@@ -172,12 +172,18 @@ function downloadAudioBuffer(audioBuffer, filename, asFloat) {
// which exceeds the threshold. The default is 0.
// options.bitDepth: The expected result is assumed to come from an audio
// file with this number of bits of precision. The default is 16.
-function compareBuffersWithConstraints(actual, expected, options) {
+function compareBuffersWithConstraints(should, actual, expected, options) {
if (!options)
options = {};
- if (actual.length !== expected.length)
- testFailed('Buffer length mismatches.');
+ // Only print out the message if the lengths are different; the
+ // expectation is that they are the same, so don't clutter up the
+ // output.
+ if (actual.length !== expected.length) {
+ should(actual.length === expected.length,
+ "Length of actual and expected buffers should match")
+ .beTrue();
+ }
var maxError = -1;
var diffCount = 0;
@@ -212,13 +218,16 @@ function compareBuffersWithConstraints(actual, expected, options) {
var snr = 10 * Math.log10(signalPower / noisePower);
var maxErrorULP = maxError * scaleFactor;
- Should("SNR", snr).beGreaterThanOrEqualTo(thresholdSNR);
+ should(snr, "SNR").beGreaterThanOrEqualTo(thresholdSNR);
- Should(options.prefix + ': Maximum difference (in ulp units (' + bitDepth + '-bits))',
- maxErrorULP).beLessThanOrEqualTo(thresholdDiffULP);
+ should(maxErrorULP,
+ options.prefix + ': Maximum difference (in ulp units (' + bitDepth +
+ '-bits))'
+ ).beLessThanOrEqualTo(thresholdDiffULP);
- Should(options.prefix + ': Number of differences between results', diffCount)
- .beLessThanOrEqualTo(thresholdDiffCount);
+ should(diffCount, options.prefix +
+ ': Number of differences between results').beLessThanOrEqualTo(
+ thresholdDiffCount);
}
// Create an impulse in a buffer of length sampleFrameLength
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiosource-time-limits.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698