Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / webaudio / delaynode.html
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5 <script src="../resources/js-test.js"></script>
6 <script src="resources/audio-testing.js"></script>
7 <script src="resources/delay-testing.js"></script>
8 </head>
9
10 <body>
11
12 <div id="description"></div>
13 <div id="console"></div>
14
15 <script>
16 description("Tests attribute and basic functionality of Delay.");
17
18 function runTest() {
19     window.jsTestIsAsync = true;
20         
21     // Create offline audio context.
22     var context = new webkitOfflineAudioContext(1, sampleRate * renderLengthSeconds, sampleRate);
23     var toneBuffer = createToneBuffer(context, 20, 20 * toneLengthSeconds, sampleRate); // 20Hz tone
24     
25     var bufferSource = context.createBufferSource();
26     bufferSource.buffer = toneBuffer;
27
28     var delay = context.createDelay();
29     
30     window.delay = delay;
31     shouldBeTrue("delay.numberOfInputs === 1");
32     shouldBeTrue("delay.numberOfOutputs === 1");
33     shouldBeTrue("delay.delayTime.defaultValue === 0.0");
34     shouldBeTrue("delay.delayTime.minValue === 0.0");
35     shouldBeTrue("delay.delayTime.maxValue === 1.0");
36     shouldBeTrue("delay.delayTime.value === 0.0");
37
38     delay.delayTime.value = delayTimeSeconds;
39     shouldBeTrue("delay.delayTime.value === 0.5");
40
41     bufferSource.connect(delay);
42     delay.connect(context.destination);
43     bufferSource.start(0);
44     
45     context.oncomplete = checkDelayedResult(toneBuffer);
46     context.startRendering();
47 }
48
49 runTest();
50
51 </script>
52 </body>
53 </html>