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

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

Issue 2780433005: Convert AudioParam tests to new Audit (Closed)
Patch Set: Address review comments Created 3 years, 8 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 <script src="../../resources/testharness.js"></script> 4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script> 5 <script src="../../resources/testharnessreport.js"></script>
6 <script src="../resources/audit-util.js"></script> 6 <script src="../resources/audit-util.js"></script>
7 <script src="../resources/audio-testing.js"></script> 7 <script src="../resources/audit.js"></script>
8 <title>AudioParam with Huge End Time</title> 8 <title>AudioParam with Huge End Time</title>
9 </head> 9 </head>
10 10
11 <body> 11 <body>
12 <script> 12 <script>
13 var sampleRate = 48000; 13 var sampleRate = 48000;
14 // Render for some small (but fairly arbitrary) time. 14 // Render for some small (but fairly arbitrary) time.
15 var renderDuration = 0.125; 15 var renderDuration = 0.125;
16 // Any huge time value that won't fit in a size_t (2^64 on a 64-bit machin e). 16 // Any huge time value that won't fit in a size_t (2^64 on a 64-bit machin e).
17 var largeTime = 1e300; 17 var largeTime = 1e300;
18 18
19 var audit = Audit.createTaskRunner(); 19 var audit = Audit.createTaskRunner();
20 20
21 // See crbug.com/582701. Create an audioparam with a huge end time and ve rify that to 21 // See crbug.com/582701. Create an audioparam with a huge end time and ve rify that to
22 // automation is run. We don't care about the actual results, just that i t runs. 22 // automation is run. We don't care about the actual results, just that i t runs.
23 23
24 // Test linear ramp with huge end time 24 // Test linear ramp with huge end time
25 audit.defineTask("linearRamp", function (done) { 25 audit.define("linearRamp", (task, should) => {
26 var graph = createGraph(); 26 var graph = createGraph();
27 graph.gain.gain.linearRampToValueAtTime(0.1, largeTime); 27 graph.gain.gain.linearRampToValueAtTime(0.1, largeTime);
28 28
29 graph.source.start(); 29 graph.source.start();
30 graph.context.startRendering().then(function (buffer) { 30 graph.context.startRendering().then(function (buffer) {
31 Should("linearRampToValue(0.1, " + largeTime + ")", true) 31 should(true, "linearRampToValue(0.1, " + largeTime + ")")
32 .summarize("successfully rendered", 32 .message("successfully rendered",
33 "unsuccessfully rendered"); 33 "unsuccessfully rendered");
34 }).then(done); 34 }).then(() => task.done());
35 }); 35 });
36 36
37 // Test exponential ramp with huge end time 37 // Test exponential ramp with huge end time
38 audit.defineTask("exponentialRamp", function (done) { 38 audit.define("exponentialRamp", (task, should) => {
39 var graph = createGraph(); 39 var graph = createGraph();
40 graph.gain.gain.exponentialRampToValueAtTime(.1, largeTime); 40 graph.gain.gain.exponentialRampToValueAtTime(.1, largeTime);
41 41
42 graph.source.start(); 42 graph.source.start();
43 graph.context.startRendering().then(function (buffer) { 43 graph.context.startRendering().then(function (buffer) {
44 Should("exponentialRampToValue(0.1, " + largeTime + ")", true) 44 should(true, "exponentialRampToValue(0.1, " + largeTime + ")")
45 .summarize("successfully rendered", 45 .message("successfully rendered",
46 "unsuccessfully rendered"); 46 "unsuccessfully rendered");
47 }).then(done); 47 }).then(() => task.done());
48 }); 48 });
49 49
50 audit.defineTask("finish", function (done) { 50 audit.run();
51 done();
52 });
53
54 audit.runTasks();
55 51
56 // Create the graph and return the context, the source, and the gain node. 52 // Create the graph and return the context, the source, and the gain node.
57 function createGraph() { 53 function createGraph() {
58 var context = new OfflineAudioContext(1, renderDuration * sampleRate, sa mpleRate); 54 var context = new OfflineAudioContext(1, renderDuration * sampleRate, sa mpleRate);
59 var src = context.createBufferSource(); 55 var src = context.createBufferSource();
60 src.buffer = createConstantBuffer(context, 1, 1); 56 src.buffer = createConstantBuffer(context, 1, 1);
61 src.loop = true; 57 src.loop = true;
62 var gain = context.createGain(); 58 var gain = context.createGain();
63 src.connect(gain); 59 src.connect(gain);
64 gain.connect(context.destination); 60 gain.connect(context.destination);
65 gain.gain.setValueAtTime(1, 0.1 / sampleRate); 61 gain.gain.setValueAtTime(1, 0.1 / sampleRate);
66 62
67 return { 63 return {
68 context: context, 64 context: context,
69 gain: gain, 65 gain: gain,
70 source: src 66 source: src
71 }; 67 };
72 } 68 }
73 69
74 </script> 70 </script>
75 </body> 71 </body>
76 </html> 72 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698