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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurveAtTime-interpolation.html

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 <!doctype html> 1 <!doctype html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Test Interpolation for AudioParam.setValueCurveAtTime</title> 4 <title>Test Interpolation for AudioParam.setValueCurveAtTime</title>
5 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script> 6 <script src="../../resources/testharnessreport.js"></script>
7 <script src="../resources/audit-util.js"></script> 7 <script src="../resources/audit-util.js"></script>
8 <script src="../resources/audio-testing.js"></script> 8 <script src="../resources/audio-testing.js"></script>
9 <title>Test Interpolation for AudioParam.setValueCurveAtTime</title> 9 <title>Test Interpolation for AudioParam.setValueCurveAtTime</title>
10 </head> 10 </head>
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 gain.gain.value = 0; 198 gain.gain.value = 0;
199 gain.gain.setValueCurveAtTime(curve, config.curveStartTime, config.curve Duration); 199 gain.gain.setValueCurveAtTime(curve, config.curveStartTime, config.curve Duration);
200 // This is to verify that setValueCurveAtTime ends appropriately. 200 // This is to verify that setValueCurveAtTime ends appropriately.
201 gain.gain.setValueAtTime(1, config.fullGainTime); 201 gain.gain.setValueAtTime(1, config.fullGainTime);
202 202
203 source.connect(gain); 203 source.connect(gain);
204 gain.connect(context.destination); 204 gain.connect(context.destination);
205 source.start(); 205 source.start();
206 206
207 // Some consistency checks on the test parameters 207 // Some consistency checks on the test parameters
208 Should("Check: Curve end time", config.curveStartTime + config.curveDura tion, { 208 let prefix = "Length " + config.curveLength + ", duration " + config.cur veDuration;
hongchan 2017/03/22 22:09:41 Let's wrap at 80.
209 Should(prefix + ": Check: Curve end time", config.curveStartTime + confi g.curveDuration, {
209 brief: true 210 brief: true
210 }) 211 })
211 .beLessThanOrEqualTo(testDurationSec); 212 .beLessThanOrEqualTo(testDurationSec);
212 Should("Check: Full gain start time", config.fullGainTime, { 213 Should(prefix + ": Check: Full gain start time", config.fullGainTime, {
213 brief: true 214 brief: true
214 }).beLessThanOrEqualTo(testDurationSec); 215 }).beLessThanOrEqualTo(testDurationSec);
215 Should("Check: Full gain start time", config.fullGainTime, { 216 Should(prefix + ": Check: Full gain start time", config.fullGainTime, {
216 brief: true 217 brief: true
217 }).beGreaterThanOrEqualTo(config.curveStartTime + config.curveDuration); 218 }).beGreaterThanOrEqualTo(config.curveStartTime + config.curveDuration);
218 219
219 // Rock and roll! 220 // Rock and roll!
220 return context.startRendering().then(checkResult(config)); 221 return context.startRendering().then(checkResult(config));
221 } 222 }
222 223
223 // Return a function to check that the rendered result matches the expecte d result. 224 // Return a function to check that the rendered result matches the expecte d result.
224 function checkResult(config) { 225 function checkResult(config) {
225 return function (renderedBuffer) { 226 return function (renderedBuffer) {
226 var success = true; 227 var success = true;
227 228
228 actualResult = renderedBuffer.getChannelData(0); 229 actualResult = renderedBuffer.getChannelData(0);
229 expectedResult = computeExpectedResult(config); 230 expectedResult = computeExpectedResult(config);
230 231
231 // Compute the SNR and max absolute difference between the actual and expected result. 232 // Compute the SNR and max absolute difference between the actual and expected result.
232 var SNR = 10*Math.log10(computeSNR(actualResult, expectedResult)); 233 var SNR = 10*Math.log10(computeSNR(actualResult, expectedResult));
233 var maxDiff = -1; 234 var maxDiff = -1;
234 var posn = -1; 235 var posn = -1;
235 236
236 for (var k = 0; k < actualResult.length; ++k) { 237 for (var k = 0; k < actualResult.length; ++k) {
237 var diff = Math.abs(actualResult[k] - expectedResult[k]); 238 var diff = Math.abs(actualResult[k] - expectedResult[k]);
238 if (maxDiff < diff) { 239 if (maxDiff < diff) {
239 maxDiff = diff; 240 maxDiff = diff;
240 posn = k; 241 posn = k;
241 } 242 }
242 } 243 }
243 244
244 success = success && Should("SNR", SNR, { 245 let prefix = "Curve length " + config.curveLength + ", duration " + co nfig.curveDuration;
hongchan 2017/03/22 22:09:41 Ditto.
246 success = success && Should(prefix + ": SNR", SNR, {
245 brief: true 247 brief: true
246 }).beGreaterThanOrEqualTo(config.snrThreshold); 248 }).beGreaterThanOrEqualTo(config.snrThreshold);
247 249
248 success = Should("Max difference", maxDiff) 250 success = Should(prefix + ": Max difference", maxDiff)
249 .beLessThanOrEqualTo(config.maxErrorThreshold) && success; 251 .beLessThanOrEqualTo(config.maxErrorThreshold) && success;
250 252
251 var message = "Test: curve length = " + config.curveLength + 253 var message = "Test: curve length = " + config.curveLength +
252 "; duration frames = " + 254 "; duration frames = " +
253 config.curveDuration * sampleRate; 255 config.curveDuration * sampleRate;
254 256
255 Should(message, success) 257 Should(message, success)
256 .summarize("passed", "failed"); 258 .summarize("passed", "failed");
257 } 259 }
258 } 260 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 293
292 return expected; 294 return expected;
293 } 295 }
294 296
295 audit.runTasks(); 297 audit.runTasks();
296 298
297 successfullyParsed = true; 299 successfullyParsed = true;
298 </script> 300 </script>
299 </body> 301 </body>
300 </html> 302 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698