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("Basic functionality of DelayNode with a non-default max delay time") |
|
hongchan
2017/02/06 17:20:27
At least the new code needs to be wrapped at 80 co
Raymond Toy
2017/02/06 18:41:36
Done.
| |
| 15 | |
| 16 <script> | |
| 17 description("Tests basic functionality of DelayNode with a non-default max delay time."); | |
| 18 | |
| 19 function runTest() { | |
| 20 if (window.testRunner) { | |
| 21 testRunner.dumpAsText(); | |
| 22 testRunner.waitUntilDone(); | |
| 23 } | |
| 24 | |
| 25 window.jsTestIsAsync = true; | |
| 26 | 18 |
| 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 // Create a delay node with an explicit max delay time (greater than the def ault of 1 second). | 26 // Create a delay node with an explicit max delay time (greater than the def ault of 1 second). |
| 35 var delay = context.createDelay(2); | 27 var delay = context.createDelay(2); |
| 36 // Set the delay time to a value greater than the default max delay so we ca n verify the delay | 28 // Set the delay time to a value greater than the default max delay so we ca n verify the delay |
| 37 // is working for this case. | 29 // is working for this case. |
| 38 delayTimeSeconds = 1.5; | 30 delayTimeSeconds = 1.5; |
| 39 delay.delayTime.value = delayTimeSeconds; | 31 delay.delayTime.value = delayTimeSeconds; |
| 40 | 32 |
| 41 bufferSource.connect(delay); | 33 bufferSource.connect(delay); |
| 42 delay.connect(context.destination); | 34 delay.connect(context.destination); |
| 43 bufferSource.start(0); | 35 bufferSource.start(0); |
| 44 | 36 |
| 45 context.oncomplete = checkDelayedResult(toneBuffer); | 37 context.startRendering() |
| 46 context.startRendering(); | 38 .then(buffer => checkDelayedResult(buffer, toneBuffer, should)) |
| 47 } | 39 .then(task.done.bind(task)); |
|
hongchan
2017/02/06 17:20:27
ditto.
Raymond Toy
2017/02/06 18:41:36
Done.
| |
| 40 }); | |
| 48 | 41 |
| 49 runTest(); | 42 audit.run(); |
| 50 | |
| 51 </script> | 43 </script> |
| 52 | 44 |
| 53 </body> | 45 </body> |
| 54 </html> | 46 </html> |
| OLD | NEW |