Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../resources/js-test.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> | |
| 4 <script src="../resources/audit-util.js"></script> | 5 <script src="../resources/audit-util.js"></script> |
| 5 <script src="../resources/audio-testing.js"></script> | 6 <script src="../resources/audit.js"></script> |
| 6 <script src="../resources/audiobuffersource-testing.js"></script> | 7 <script src="../resources/audiobuffersource-testing.js"></script> |
| 8 </head> | |
| 9 <body> | |
| 7 <script> | 10 <script> |
| 8 var context; | 11 let audit = Audit.createTaskRunner(); |
| 9 var source; | |
| 10 | 12 |
| 11 function runTest() | 13 let context; |
| 12 { | 14 let source; |
| 13 if (window.testRunner) { | |
| 14 testRunner.dumpAsText(); | |
| 15 testRunner.waitUntilDone(); | |
| 16 } | |
| 17 | 15 |
| 18 var sampleRate = 44100.0; | 16 audit.define("AudioBufferSourceNode calls its onended EventListener", |
| 19 var numberOfFrames = 32; | 17 function (task, should) { |
| 20 context = new OfflineAudioContext(1, numberOfFrames, sampleRate); | 18 let sampleRate = 44100.0; |
| 21 source = context.createBufferSource(); | 19 let numberOfFrames = 32; |
| 22 source.buffer = createTestBuffer(context, numberOfFrames); | 20 context = new OfflineAudioContext(1, numberOfFrames, sampleRate); |
| 23 source.connect(context.destination); | 21 source = context.createBufferSource(); |
| 24 source.onended = function() | 22 source.buffer = createTestBuffer(context, numberOfFrames); |
| 25 { | 23 source.connect(context.destination); |
| 26 testPassed("source.onended called."); | 24 source.onended = function () { |
| 27 if (window.testRunner) | 25 should(true, "source.onended called").beTrue(); |
| 28 testRunner.notifyDone(); | 26 task.done(); |
| 29 } | 27 } |
| 30 source.start(0); | 28 source.start(0); |
| 31 context.startRendering(); | 29 context.startRendering(); |
|
hongchan
2017/01/04 21:42:41
Q: should we change this to the promise pattern?
Raymond Toy
2017/01/04 21:46:16
Sorry, I don't follow. The test is that the onend
hongchan
2017/01/10 19:22:58
Ha, I missed that. Sorry.
| |
| 32 } | 30 }); |
| 31 | |
| 32 audit.run(); | |
| 33 </script> | 33 </script> |
| 34 | |
| 35 </head> | |
| 36 <body onload="runTest()"> | |
| 37 <div>Tests that AudioBufferSourceNode calls its onended EventListener.</div> | |
| 38 <div id="console"></div> | |
| 39 </body> | 34 </body> |
| OLD | NEW |