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

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

Issue 2657033002: Convert AudioParam tests to testharness and new Audit (Closed)
Patch Set: clang-format the JS code. Created 3 years, 10 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 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
5 <script src="../resources/audit-util.js"></script> 6 <script src="../resources/audit-util.js"></script>
6 <script src="../resources/audio-testing.js"></script> 7 <script src="../resources/audit.js"></script>
7 <script src="../resources/audioparam-testing.js"></script> 8 <script src="../resources/audioparam-testing.js"></script>
8 <title>Test AudioParam.setValueCurveAtTime</title> 9 <title>Test AudioParam.setValueCurveAtTime</title>
9 </head> 10 </head>
10 11
11 <body> 12 <body>
12 <div id="description"></div> 13 <script>
13 <div id="console"></div> 14 let audit = Audit.createTaskRunner();
14 15
15 <script> 16 // Play a long DC signal out through an AudioGainNode and for each time interval
16 description("Test AudioParam setValueCurveAtTime() functionality."); 17 // call setValueCurveAtTime() to set the values for the duration of the
17 18 // interval. Each curve is a sine wave, and we assume that the time interval is
18 // Play a long DC signal out through an AudioGainNode and for each time interval call 19 // not an exact multiple of the period. This causes a discontinuity between time
19 // setValueCurveAtTime() to set the values for the duration of the interval. Ea ch curve is a sine 20 // intervals which is used to test timing.
20 // wave, and we assume that the time interval is not an exact multiple of the pe riod. This causes a
21 // discontinuity between time intervals which is used to test timing.
22 21
23 // Number of tests to run. 22 // Number of tests to run.
24 var numberOfTests = 20; 23 let numberOfTests = 20;
25 24
26 // Max allowed difference between the rendered data and the expected result. Be cause of the linear 25 // Max allowed difference between the rendered data and the expected result.
27 // interpolation, the rendered curve isn't exactly the same as the reference. T his value is 26 // Because of the linear interpolation, the rendered curve isn't exactly the
28 // experimentally determined. 27 // same as the reference. This value is experimentally determined.
29 var maxAllowedError = 3.7194e-6; 28 let maxAllowedError = 3.7194e-6;
30 29
31 // The amplitude of the sine wave. 30 // The amplitude of the sine wave.
32 var sineAmplitude = 1; 31 let sineAmplitude = 1;
33 32
34 // Frequency of the sine wave. 33 // Frequency of the sine wave.
35 var freqHz = 440; 34 let freqHz = 440;
36 35
37 // Curve to use for setValueCurveAtTime(). 36 // Curve to use for setValueCurveAtTime().
38 var curve; 37 let curve;
39 38
40 // Sets the curve data for the entire time interval. 39 // Sets the curve data for the entire time interval.
41 function automation(value, startTime, endTime) 40 function automation(value, startTime, endTime) {
42 { 41 gainNode.gain.setValueCurveAtTime(curve, startTime, endTime - startTime);
43 gainNode.gain.setValueCurveAtTime(curve, startTime, endTime - startTime);
44 } 42 }
45 43
46 function runTest() 44 audit.define('test', function(task, should) {
47 { 45 task.describe('AudioParam setValueCurveAtTime() functionality.');
48 // The curve of values to use. 46 // The curve of values to use.
49 curve = createSineWaveArray(timeInterval, freqHz, sineAmplitude, sampleRate) ; 47 curve = createSineWaveArray(timeInterval, freqHz, sineAmplitude, sampleRate);
50 48
51 createAudioGraphAndTest(numberOfTests, 49 createAudioGraphAndTest(
52 sineAmplitude, 50 task, should, numberOfTests, sineAmplitude,
53 function(k) { 51 function(k) {
54 // Don't need to set the value. 52 // Don't need to set the value.
55 }, 53 },
56 automation, 54 automation, 'setValueCurveAtTime()', maxAllowedError,
57 "setValueCurveAtTime()", 55 createReferenceSineArray,
58 maxAllowedError, 56 2 * Math.PI * sineAmplitude * freqHz / sampleRate, differenceErrorMetric);
59 createReferenceSineArray, 57 });
60 2 * Math.PI * sineAmplitude * freqHz / sampleRate,
61 differenceErrorMetric);
62 }
63 58
64 runTest(); 59 audit.run();
65 successfullyParsed = true;
66
67 </script> 60 </script>
68 61
69 </body> 62 </body>
70 </html> 63 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698