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