OLD | NEW |
---|---|
(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/audio-testing.js"></script> | |
7 <title>AudioParam with Huge End Time</title> | |
8 </head> | |
9 | |
10 <body> | |
11 <script> | |
12 description("Test AudioParam with Huge Time Value") | |
13 window.jsTestIsAsync = true; | |
14 | |
15 var sampleRate = 48000; | |
16 // Render for some small (but fairly arbitrary) time. | |
17 var renderDuration = 0.125; | |
18 // Any huge time value that won't fit in a size_t (2^64 on a 64-bit machin e). | |
19 var largeTime = 1e300; | |
20 | |
21 var audit = Audit.createTaskRunner(); | |
22 | |
23 // See crbug.com/582701. Create an audioparam with a huge end time and ve rify that to | |
hongchan
2016/02/02 17:07:42
The URL does not exist. Typo?
Raymond Toy
2016/02/02 17:34:47
It works for me.
| |
24 // automation is run. We don't care about the actual results, just that i t runs. | |
25 | |
26 // Test linear ramp with huge end time | |
hongchan
2016/02/02 17:07:42
This test only covers linear and expo. Do we need
Raymond Toy
2016/02/02 17:34:47
I just wanted to fix the immediate issue. I filed
| |
27 audit.defineTask("linearRamp", function (done) { | |
28 var graph = createGraph(); | |
29 graph.gain.gain.linearRampToValueAtTime(0.1, largeTime); | |
30 | |
31 graph.source.start(); | |
32 graph.context.startRendering().then(function (buffer) { | |
33 testPassed("linearRampToValue(0.1, " + largeTime + ") successfully ren dered."); | |
34 }).then(done); | |
35 }); | |
36 | |
37 // Test exponential ramp with huge end time | |
38 audit.defineTask("exponentialRamp", function (done) { | |
39 var graph = createGraph(); | |
40 graph.gain.gain.exponentialRampToValueAtTime(.1, largeTime); | |
41 | |
42 graph.source.start(); | |
43 graph.context.startRendering().then(function (buffer) { | |
44 testPassed("exponentialRampToValue(0.1, " + largeTime + ") successfull y rendered."); | |
45 }).then(done); | |
46 }); | |
47 | |
48 audit.defineTask("finish", function (done) { | |
49 finishJSTest(); | |
50 done(); | |
51 }); | |
52 | |
53 audit.runTasks(); | |
54 | |
55 // Create the graph and return the context, the source, and the gain node. | |
56 function createGraph() { | |
57 var context = new OfflineAudioContext(1, renderDuration * sampleRate, sa mpleRate); | |
58 var src = context.createBufferSource(); | |
59 src.buffer = createConstantBuffer(context, 1, 1); | |
60 src.loop = true; | |
61 var gain = context.createGain(); | |
62 src.connect(gain); | |
63 gain.connect(context.destination); | |
64 gain.gain.setValueAtTime(1, 0.1 / sampleRate); | |
65 | |
66 return { | |
67 context: context, | |
68 gain: gain, | |
69 source: src | |
70 }; | |
71 } | |
72 | |
73 </script> | |
74 </body> | |
75 </html> | |
OLD | NEW |