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

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

Issue 1674173003: Carefully handle large end time values in AudioParam automations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2623
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/audioparam-large-endtime-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/webaudio/audioparam-large-endtime.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-large-endtime.html b/third_party/WebKit/LayoutTests/webaudio/audioparam-large-endtime.html
new file mode 100644
index 0000000000000000000000000000000000000000..99523d2c0c3f6b7ff6e0c7026285e460bef1506f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-large-endtime.html
@@ -0,0 +1,75 @@
+<!doctype html>
+<html>
+ <head>
+ <script src="../resources/js-test.js"></script>
+ <script src="resources/compatibility.js"></script>
+ <script src="resources/audio-testing.js"></script>
+ <title>AudioParam with Huge End Time</title>
+ </head>
+
+ <body>
+ <script>
+ description("Test AudioParam with Huge Time Value")
+ window.jsTestIsAsync = true;
+
+ var sampleRate = 48000;
+ // Render for some small (but fairly arbitrary) time.
+ var renderDuration = 0.125;
+ // Any huge time value that won't fit in a size_t (2^64 on a 64-bit machine).
+ var largeTime = 1e300;
+
+ var 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.defineTask("linearRamp", function (done) {
+ var graph = createGraph();
+ graph.gain.gain.linearRampToValueAtTime(0.1, largeTime);
+
+ graph.source.start();
+ graph.context.startRendering().then(function (buffer) {
+ testPassed("linearRampToValue(0.1, " + largeTime + ") successfully rendered.");
+ }).then(done);
+ });
+
+ // Test exponential ramp with huge end time
+ audit.defineTask("exponentialRamp", function (done) {
+ var graph = createGraph();
+ graph.gain.gain.exponentialRampToValueAtTime(.1, largeTime);
+
+ graph.source.start();
+ graph.context.startRendering().then(function (buffer) {
+ testPassed("exponentialRampToValue(0.1, " + largeTime + ") successfully rendered.");
+ }).then(done);
+ });
+
+ audit.defineTask("finish", function (done) {
+ finishJSTest();
+ done();
+ });
+
+ audit.runTasks();
+
+ // Create the graph and return the context, the source, and the gain node.
+ function createGraph() {
+ var context = new OfflineAudioContext(1, renderDuration * sampleRate, sampleRate);
+ var src = context.createBufferSource();
+ src.buffer = createConstantBuffer(context, 1, 1);
+ src.loop = true;
+ var 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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/audioparam-large-endtime-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698