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

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

Issue 2768983002: Fix duplicate test names in WebAudio tests (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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 /** 6 /**
7 * @fileOverview This file includes legacy utility functions for the layout 7 * @fileOverview This file includes legacy utility functions for the layout
8 * test. 8 * test.
9 */ 9 */
10 10
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // an exact match between it and the actual floating-point result. 207 // an exact match between it and the actual floating-point result.
208 if (Math.abs(diff) > scaleFactor) 208 if (Math.abs(diff) > scaleFactor)
209 diffCount++; 209 diffCount++;
210 } 210 }
211 211
212 var snr = 10 * Math.log10(signalPower / noisePower); 212 var snr = 10 * Math.log10(signalPower / noisePower);
213 var maxErrorULP = maxError * scaleFactor; 213 var maxErrorULP = maxError * scaleFactor;
214 214
215 Should("SNR", snr).beGreaterThanOrEqualTo(thresholdSNR); 215 Should("SNR", snr).beGreaterThanOrEqualTo(thresholdSNR);
216 216
217 Should('Maximum difference (in ulp units (' + bitDepth + '-bits))', 217 Should(options.prefix + ': Maximum difference (in ulp units (' + bitDepth + '-bits))',
218 maxErrorULP).beLessThanOrEqualTo(thresholdDiffULP); 218 maxErrorULP).beLessThanOrEqualTo(thresholdDiffULP);
219 219
220 Should('Number of differences between results', diffCount) 220 Should(options.prefix + ': Number of differences between results', diffCount )
221 .beLessThanOrEqualTo(thresholdDiffCount); 221 .beLessThanOrEqualTo(thresholdDiffCount);
222 } 222 }
223 223
224 // Create an impulse in a buffer of length sampleFrameLength 224 // Create an impulse in a buffer of length sampleFrameLength
225 function createImpulseBuffer(context, sampleFrameLength) { 225 function createImpulseBuffer(context, sampleFrameLength) {
226 var audioBuffer = context.createBuffer(1, sampleFrameLength, context.sampleR ate); 226 var audioBuffer = context.createBuffer(1, sampleFrameLength, context.sampleR ate);
227 var n = audioBuffer.length; 227 var n = audioBuffer.length;
228 var dataL = audioBuffer.getChannelData(0); 228 var dataL = audioBuffer.getChannelData(0);
229 229
230 for (var k = 0; k < n; ++k) { 230 for (var k = 0; k < n; ++k) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 var length = Math.min(actual.length, expected.length); 321 var length = Math.min(actual.length, expected.length);
322 322
323 for (var k = 0; k < length; ++k) { 323 for (var k = 0; k < length; ++k) {
324 var diff = actual[k] - expected[k]; 324 var diff = actual[k] - expected[k];
325 signalPower += expected[k] * expected[k]; 325 signalPower += expected[k] * expected[k];
326 noisePower += diff * diff; 326 noisePower += diff * diff;
327 } 327 }
328 328
329 return signalPower / noisePower; 329 return signalPower / noisePower;
330 } 330 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698