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

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

Issue 2658703002: Convert AudioParam Audit tests to testharness (Closed)
Patch Set: Rebase test 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> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 3
4 <head> 4 <head>
5 <script src="../../resources/js-test.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script>
6 <script src="../resources/audit-util.js"></script> 7 <script src="../resources/audit-util.js"></script>
7 <script src="../resources/audio-testing.js"></script> 8 <script src="../resources/audio-testing.js"></script>
8 <script src="../resources/audioparam-testing.js"></script> 9 <script src="../resources/audioparam-testing.js"></script>
9 </head> 10 </head>
10 11
11 <body> 12 <body>
12 <script> 13 <script>
13 description('Test method chaining feature of AudioParam automation methods.' );
14 window.jsTestIsAsync = true;
15 14
16 var sampleRate = 44100; 15 var sampleRate = 44100;
17 16
18 // Create a dummy array for setValueCurveAtTime method. 17 // Create a dummy array for setValueCurveAtTime method.
19 var curveArray = new Float32Array([5.0, 6.0]); 18 var curveArray = new Float32Array([5.0, 6.0]);
20 19
21 // AudioNode dictionary with associated dummy arguments. 20 // AudioNode dictionary with associated dummy arguments.
22 var methodDictionary = [ 21 var methodDictionary = [
23 { name: 'setValueAtTime', args: [1.0, 0.0] }, 22 { name: 'setValueAtTime', args: [1.0, 0.0] },
24 { name: 'linearRampToValueAtTime', args: [2.0, 1.0] }, 23 { name: 'linearRampToValueAtTime', args: [2.0, 1.0] },
25 { name: 'exponentialRampToValueAtTime', args: [3.0, 2.0] }, 24 { name: 'exponentialRampToValueAtTime', args: [3.0, 2.0] },
26 { name: 'setTargetAtTime', args: [4.0, 2.0, 0.5] }, 25 { name: 'setTargetAtTime', args: [4.0, 2.0, 0.5] },
27 { name: 'setValueCurveAtTime', args: [curveArray, 5.0, 1.0] }, 26 { name: 'setValueCurveAtTime', args: [curveArray, 5.0, 1.0] },
28 { name: 'cancelScheduledValues', args: [6.0] } 27 { name: 'cancelScheduledValues', args: [6.0] }
29 ]; 28 ];
30 29
31 function verifyReturnedParam(config) { 30 function verifyReturnedParam(config) {
32 if (config.source === config.returned) 31 Should('The return value of ' + config.desc + ' matches the source AudioPa ram',
33 testPassed('The return value of ' + config.desc + ' matches the source A udioParam.'); 32 config.source === config.returned)
34 else 33 .beEqualTo(true);
35 testFailed('The return value of ' + config.desc + ' does NOT match sourc e AudioParam.');
36 } 34 }
37 35
38 var audit = Audit.createTaskRunner(); 36 var audit = Audit.createTaskRunner();
39 37
40 // Task: testing entries from the dictionary. 38 // Task: testing entries from the dictionary.
41 audit.defineTask('from-dictionary', function (done) { 39 audit.defineTask('from-dictionary', function (done) {
42 var context = new AudioContext(); 40 var context = new AudioContext();
43 41
44 methodDictionary.forEach(function (method) { 42 methodDictionary.forEach(function (method) {
45 var sourceParam = context.createGain().gain; 43 var sourceParam = context.createGain().gain;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // envelope and the internal implementation. (i.e. double/float and 122 // envelope and the internal implementation. (i.e. double/float and
125 // rounding up) The error threshold is adjusted empirically through 123 // rounding up) The error threshold is adjusted empirically through
126 // the local testing. 124 // the local testing.
127 Should('The rendered envelope', buffer.getChannelData(0), { 125 Should('The rendered envelope', buffer.getChannelData(0), {
128 numberOfArrayLog: 5 126 numberOfArrayLog: 5
129 }).beCloseToArray(expectedEnvelope, 4.0532e-6); 127 }).beCloseToArray(expectedEnvelope, 4.0532e-6);
130 }).then(done); 128 }).then(done);
131 }); 129 });
132 130
133 audit.defineTask('finish', function (done) { 131 audit.defineTask('finish', function (done) {
134 finishJSTest();
135 done(); 132 done();
136 }); 133 });
137 134
138 audit.runTasks(); 135 audit.runTasks();
139 136
140 successfullyParsed = true; 137 successfullyParsed = true;
141 </script> 138 </script>
142 </body> 139 </body>
143 140
144 </html> 141 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698