summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-large-endtime.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-large-endtime.html')
-rw-r--r--testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-large-endtime.html73
1 files changed, 73 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-large-endtime.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-large-endtime.html
new file mode 100644
index 0000000000..d8f38eeba0
--- /dev/null
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-large-endtime.html
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>
+ AudioParam with Huge End Time
+ </title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/webaudio/resources/audit-util.js"></script>
+ <script src="/webaudio/resources/audit.js"></script>
+ </head>
+ <body>
+ <script id="layout-test-code">
+ let sampleRate = 48000;
+ // Render for some small (but fairly arbitrary) time.
+ let renderDuration = 0.125;
+ // Any huge time value that won't fit in a size_t (2^64 on a 64-bit
+ // machine).
+ let largeTime = 1e300;
+
+ let audit = Audit.createTaskRunner();
+
+ // See crbug.com/582701. Create an audioparam with a huge end time and
+ // verify that to automation is run. We don't care about the actual
+ // results, just that it runs.
+
+ // Test linear ramp with huge end time
+ audit.define('linearRamp', (task, should) => {
+ let graph = createGraph();
+ graph.gain.gain.linearRampToValueAtTime(0.1, largeTime);
+
+ graph.source.start();
+ graph.context.startRendering()
+ .then(function(buffer) {
+ should(true, 'linearRampToValue(0.1, ' + largeTime + ')')
+ .message('successfully rendered', 'unsuccessfully rendered');
+ })
+ .then(() => task.done());
+ });
+
+ // Test exponential ramp with huge end time
+ audit.define('exponentialRamp', (task, should) => {
+ let graph = createGraph();
+ graph.gain.gain.exponentialRampToValueAtTime(.1, largeTime);
+
+ graph.source.start();
+ graph.context.startRendering()
+ .then(function(buffer) {
+ should(true, 'exponentialRampToValue(0.1, ' + largeTime + ')')
+ .message('successfully rendered', 'unsuccessfully rendered');
+ })
+ .then(() => task.done());
+ });
+
+ audit.run();
+
+ // Create the graph and return the context, the source, and the gain node.
+ function createGraph() {
+ let context =
+ new OfflineAudioContext(1, renderDuration * sampleRate, sampleRate);
+ let src = context.createBufferSource();
+ src.buffer = createConstantBuffer(context, 1, 1);
+ src.loop = true;
+ let gain = context.createGain();
+ src.connect(gain);
+ gain.connect(context.destination);
+ gain.gain.setValueAtTime(1, 0.1 / sampleRate);
+
+ return {context: context, gain: gain, source: src};
+ }
+ </script>
+ </body>
+</html>