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

Unified Diff: LayoutTests/webaudio/audiobuffersource-one-sample-loop.html

Issue 637653002: Looping one-sample AudioBufferSourceNode should work. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | LayoutTests/webaudio/audiobuffersource-one-sample-loop-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/webaudio/audiobuffersource-one-sample-loop.html
diff --git a/LayoutTests/webaudio/audiobuffersource-one-sample-loop.html b/LayoutTests/webaudio/audiobuffersource-one-sample-loop.html
new file mode 100644
index 0000000000000000000000000000000000000000..f15d77e0b6a774a962f6858ef3f4cc930e211ae3
--- /dev/null
+++ b/LayoutTests/webaudio/audiobuffersource-one-sample-loop.html
@@ -0,0 +1,64 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Test AudioBufferSourceNode With Looping a Single-Sample Buffer</title>
+ <script src="resources/compatibility.js"></script>
+ <script src="resources/audio-testing.js"></script>
+ <script src="../resources/js-test.js"></script>
+ </head>
+
+ <body>
+ <script>
+ description("Test AudioBufferSourceNode With Looping a Single-Sample Buffer");
+
+ var context;
+ var source;
+ var buffer;
+ var renderedData;
+
+ var sampleRate = 44100;
+ var testDurationSamples = 1000;
+
+ function checkResult (event) {
+ var success = true;
+
+ renderedData = event.renderedBuffer.getChannelData(0);
+ // Check that the rendered data is all ones, like the buffer source.
+ for (k = 0; k < renderedData.length; ++k) {
+ if (renderedData[k] != 1) {
+ success = false;
+ testFailed("Expected all ones, but sample " + k + " is " + renderedData[k]);
+ break;
+ }
+ }
+ if (success)
+ testPassed("All samples equal to 1");
+ finishJSTest();
+ }
+
+ function runTest() {
+ window.jsTestIsAsync = true;
+
+ // Create the offline context for the test.
+ context = new OfflineAudioContext(1, testDurationSamples, sampleRate);
+ context.oncomplete = checkResult;
+
+ // Create the single sample buffer
+ buffer = createConstantBuffer(context, 1, 1);
+
+ // Create the source and connect it to the destination
+ source = context.createBufferSource();
+ source.buffer = buffer;
+ source.loop = true;
+ source.connect(context.destination);
+ source.start();
+
+ // Render it!
+ context.startRendering();
+ }
+
+ runTest();
+ succesfullyParsed = true;
+ </script>
+ </body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/webaudio/audiobuffersource-one-sample-loop-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698