Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!doctype html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title>Test ConstantSourceNode onended</title> | |
| 5 <script src="../resources/testharness.js"></script> | |
| 6 <script src="../resources/testharnessreport.js"></script> | |
| 7 <script src="resources/audio-testing.js"></script> | |
| 8 </head> | |
| 9 | |
| 10 <body> | |
| 11 <script> | |
| 12 var sampleRate = 44100.0; | |
| 13 // Number of frames that the source will run; fairly arbitrary | |
| 14 var numberOfFrames = 32; | |
| 15 // Number of frames to render; arbitrary, but should be larger than | |
| 16 // numberOfFrames; | |
| 17 var renderFrames = 16 * numberOfFrames; | |
| 18 | |
| 19 var audit = Audit.createTaskRunner(); | |
| 20 | |
| 21 audit.defineTask("onended", function (taskDone) { | |
| 22 var context = new OfflineAudioContext(1, renderFrames, sampleRate); | |
| 23 var src = new ConstantSourceNode(context); | |
| 24 src.connect(context.destination); | |
| 25 | |
| 26 var tester = async_test("ConstantSourceNode onended event"); | |
| 27 | |
| 28 src.onended = function () { | |
| 29 tester.step(function () { | |
| 30 assert_true(true, "ConstantSourceNode.onended fired"); | |
| 31 }); | |
| 32 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
| |
| 33 }; | |
| 34 | |
| 35 src.start(); | |
| 36 src.stop(numberOfFrames / context.sampleRate); | |
| 37 | |
| 38 context.startRendering().then(taskDone); | |
| 39 }); | |
| 40 | |
| 41 audit.runTasks(); | |
| 42 </script> | |
| 43 </body> | |
| 44 </html> | |
| OLD | NEW |