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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime.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.setTargetAtTime</title> 9 <title>Test AudioParam.setTargetAtTime</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 call setValueAtTime()
16 description("Test AudioParam setTargetAtTime() functionality."); 17 // and setTargetAtTime at regular intervals to set the starting value and the
17 18 // target value. Each time interval has a ramp with a different starting and
18 // Play a long DC signal out through an AudioGainNode, and call setValueAtTime() and 19 // target value so that there is a discontinuity at each time interval boundary.
19 // setTargetAtTime at regular intervals to set the starting value and the target 20 // The discontinuity is for testing timing. Also, we alternate between an
20 // value. Each time interval has a ramp with a different starting and target val ue so that 21 // increasing and decreasing ramp for each interval.
21 // there is a discontinuity at each time interval boundary. The discontinuity i s for testing
22 // timing. Also, we alternate between an increasing and decreasing ramp for eac h interval.
23 22
24 // Number of tests to run. 23 // Number of tests to run.
25 var numberOfTests = 100; 24 var numberOfTests = 100;
26 25
27 // Max allowed difference between the rendered data and the expected result. 26 // Max allowed difference between the rendered data and the expected result.
28 var maxAllowedError = 1.6953e-6; 27 var maxAllowedError = 1.6953e-6;
29 28
30 // The AudioGainNode starts with this value instead of the default value. 29 // The AudioGainNode starts with this value instead of the default value.
31 var initialValue = 100; 30 var initialValue = 100;
32 31
33 // Set the gain node value to the specified value at the specified time. 32 // Set the gain node value to the specified value at the specified time.
34 function setValue(value, time) 33 function setValue(value, time) {
35 { 34 gainNode.gain.setValueAtTime(value, time);
36 gainNode.gain.setValueAtTime(value, time);
37 } 35 }
38 36
39 // Generate an exponential approach starting at |startTime| with a target value of |value|. 37 // Generate an exponential approach starting at |startTime| with a target value
40 function automation(value, startTime, endTime) 38 // of |value|.
41 { 39 function automation(value, startTime, endTime){
42 // endTime is not used for setTargetAtTime. 40 // endTime is not used for setTargetAtTime.
43 gainNode.gain.setTargetAtTime(value, startTime, timeConstant) 41 gainNode.gain.setTargetAtTime(value, startTime, timeConstant)}
44 }
45 42
46 function runTest() 43 audit.define('test', function(task, should) {
47 { 44 task.describe('AudioParam setTargetAtTime() functionality.');
48 createAudioGraphAndTest(numberOfTests, 45 createAudioGraphAndTest(
49 initialValue, 46 task, should, numberOfTests, initialValue, setValue, automation,
50 setValue, 47 'setTargetAtTime()', maxAllowedError, createExponentialApproachArray);
51 automation, 48 });
52 "setTargetAtTime()",
53 maxAllowedError,
54 createExponentialApproachArray);
55 }
56 49
57 runTest(); 50 audit.run();
58 successfullyParsed = true;
59
60 </script> 51 </script>
61 52
62 </body> 53 </body>
63 </html> 54 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698