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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/constant-source-onended.html

Issue 2134813002: Implement ConstantSourceNode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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
Index: third_party/WebKit/LayoutTests/webaudio/constant-source-onended.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/constant-source-onended.html b/third_party/WebKit/LayoutTests/webaudio/constant-source-onended.html
new file mode 100644
index 0000000000000000000000000000000000000000..bb01af37042b87886d47f25b15064725b48a5aef
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/webaudio/constant-source-onended.html
@@ -0,0 +1,44 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Test ConstantSourceNode onended</title>
+ <script src="../resources/testharness.js"></script>
+ <script src="../resources/testharnessreport.js"></script>
+ <script src="resources/audio-testing.js"></script>
+ </head>
+
+ <body>
+ <script>
+ var sampleRate = 44100.0;
+ // Number of frames that the source will run; fairly arbitrary
+ var numberOfFrames = 32;
+ // Number of frames to render; arbitrary, but should be larger than
+ // numberOfFrames;
+ var renderFrames = 16 * numberOfFrames;
+
+ var audit = Audit.createTaskRunner();
+
+ audit.defineTask("onended", function (taskDone) {
+ var context = new OfflineAudioContext(1, renderFrames, sampleRate);
+ var src = new ConstantSourceNode(context);
+ src.connect(context.destination);
+
+ var tester = async_test("ConstantSourceNode onended event");
+
+ src.onended = function () {
+ tester.step(function () {
+ assert_true(true, "ConstantSourceNode.onended fired");
+ });
+ tester.done();
hongchan 2016/10/06 18:10:23 This and taskDone() at the bottom. Which one ends
Raymond Toy 2016/10/07 15:24:07 Yeah, I think we should just not use Audit here in
+ };
+
+ src.start();
+ src.stop(numberOfFrames / context.sampleRate);
+
+ context.startRendering().then(taskDone);
+ });
+
+ audit.runTasks();
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698