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

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

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

Powered by Google App Engine
This is Rietveld 408576698