Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 | 2 |
| 3 <html> | 3 <html> |
| 4 <head> | 4 <head> |
| 5 <script src="../../resources/js-test.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> | |
| 6 <script src="../resources/audit-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
| 7 <script src="../resources/audio-testing.js"></script> | 8 <script src="../resources/audit.js"></script> |
| 8 <script src="../resources/delay-testing.js"></script> | 9 <script src="../resources/delay-testing.js"></script> |
| 9 </head> | 10 </head> |
| 10 | 11 |
| 11 <body> | 12 <body> |
| 13 <script> | |
| 14 let audit = Audit.createTaskRunner(); | |
| 12 | 15 |
| 13 <div id="description"></div> | 16 audit.define("test", function (task, should) { |
| 14 <div id="console"></div> | 17 task.describe("DelayNode with delay set to default maximum delay"); |
| 15 | 18 |
| 16 <script> | |
| 17 description("Tests DelayNode with delay set to default maximum delay."); | |
| 18 | |
| 19 function runTest() { | |
| 20 if (window.testRunner) { | |
| 21 testRunner.dumpAsText(); | |
| 22 testRunner.waitUntilDone(); | |
| 23 } | |
| 24 | |
| 25 window.jsTestIsAsync = true; | |
| 26 | |
| 27 // Create offline audio context. | 19 // Create offline audio context. |
| 28 var context = new OfflineAudioContext(1, sampleRate * renderLengthSeconds, s ampleRate); | 20 var context = new OfflineAudioContext(1, sampleRate * renderLengthSeconds, s ampleRate); |
| 29 var toneBuffer = createToneBuffer(context, 20, 20 * toneLengthSeconds, sampl eRate); // 20Hz tone | 21 var toneBuffer = createToneBuffer(context, 20, 20 * toneLengthSeconds, sampl eRate); // 20Hz tone |
| 30 | 22 |
| 31 var bufferSource = context.createBufferSource(); | 23 var bufferSource = context.createBufferSource(); |
| 32 bufferSource.buffer = toneBuffer; | 24 bufferSource.buffer = toneBuffer; |
| 33 | 25 |
| 34 var delay = context.createDelay(); | 26 var delay = context.createDelay(); |
| 35 delayTimeSeconds = 1; | 27 delayTimeSeconds = 1; |
| 36 delay.delayTime.value = delayTimeSeconds; | 28 delay.delayTime.value = delayTimeSeconds; |
| 37 | 29 |
| 38 bufferSource.connect(delay); | 30 bufferSource.connect(delay); |
| 39 delay.connect(context.destination); | 31 delay.connect(context.destination); |
| 40 bufferSource.start(0); | 32 bufferSource.start(0); |
| 41 | 33 |
| 42 context.oncomplete = checkDelayedResult(toneBuffer); | 34 context.startRendering() |
| 43 context.startRendering(); | 35 .then(buffer => checkDelayedResult(buffer, toneBuffer, should)) |
| 44 } | 36 .then(task.done.bind(task)); |
|
hongchan
2017/02/06 17:20:27
task => task.done()
This might be more readable.
Raymond Toy
2017/02/06 18:41:36
Done.
| |
| 37 }); | |
| 45 | 38 |
| 46 runTest(); | 39 audit.run(); |
| 47 | 40 |
| 48 </script> | 41 </script> |
| 49 | 42 |
| 50 </body> | 43 </body> |
| 51 </html> | 44 </html> |
| OLD | NEW |