| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 | |
| 3 <html> | |
| 4 <head> | |
| 5 <script src="../resources/js-test.js"></script> | |
| 6 <script src="resources/compatibility.js"></script> | |
| 7 <script src="resources/audit-util.js"></script> | |
| 8 <script src="resources/audio-testing.js"></script> | |
| 9 <script src="resources/delay-testing.js"></script> | |
| 10 </head> | |
| 11 | |
| 12 <body> | |
| 13 | |
| 14 <div id="description"></div> | |
| 15 <div id="console"></div> | |
| 16 | |
| 17 <script> | |
| 18 description("Tests attribute and maximum allowed delay of DelayNode."); | |
| 19 | |
| 20 function runTest() { | |
| 21 if (window.testRunner) { | |
| 22 testRunner.dumpAsText(); | |
| 23 testRunner.waitUntilDone(); | |
| 24 } | |
| 25 | |
| 26 window.jsTestIsAsync = true; | |
| 27 | |
| 28 // Create offline audio context. | |
| 29 var context = new OfflineAudioContext(1, sampleRate * renderLengthSeconds, s
ampleRate); | |
| 30 var toneBuffer = createToneBuffer(context, 20, 20 * toneLengthSeconds, sampl
eRate); // 20Hz tone | |
| 31 | |
| 32 var bufferSource = context.createBufferSource(); | |
| 33 bufferSource.buffer = toneBuffer; | |
| 34 | |
| 35 window.context = context; | |
| 36 shouldThrow("context.createDelay(180)"); | |
| 37 shouldThrow("context.createDelay(0)"); | |
| 38 shouldThrow("context.createDelay(-1)"); | |
| 39 shouldThrow("context.createDelay(NaN)"); | |
| 40 | |
| 41 var delay = context.createDelay(179); | |
| 42 delay.delayTime.value = delayTimeSeconds; | |
| 43 window.delay = delay; | |
| 44 shouldBeTrue("delay.delayTime.value === 0.5"); | |
| 45 | |
| 46 bufferSource.connect(delay); | |
| 47 delay.connect(context.destination); | |
| 48 bufferSource.start(0); | |
| 49 | |
| 50 context.oncomplete = checkDelayedResult(toneBuffer); | |
| 51 context.startRendering(); | |
| 52 } | |
| 53 | |
| 54 runTest(); | |
| 55 | |
| 56 </script> | |
| 57 | |
| 58 </body> | |
| 59 </html> | |
| OLD | NEW |