Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / webaudio / javascriptaudionode-zero-input-channels.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <script src="resources/audio-testing.js"></script>
5 <script src="../resources/js-test.js"></script>
6 </head>
7
8 <body>
9 <div id="description"></div>
10 <div id="console"></div>
11
12 <script>
13 description("Tests that JavaScriptAudioNode accepts 0 input channels.");
14
15 var sampleRate = 44100.0;
16 var renderLengthInFrames = 512;
17 var bufferSize = 512;
18
19 function checkResult(e)
20 {
21     testPassed("JavaScriptAudioNode accepts 0 input channels.");
22
23     finishJSTest();
24 }
25
26 function runTest()
27 {
28     window.jsTestIsAsync = true;
29
30     var context = new webkitOfflineAudioContext(1, renderLengthInFrames, sampleRate);
31
32     var node;
33
34     try {  
35         node = context.createScriptProcessor(bufferSize, 0, 1);
36         testPassed("Successfully created JavaScriptAudioNode.");
37     } catch (e) {
38         testFailed("Failed to create JavaScriptAudioNode.");
39     }
40
41     var source = context.createBufferSource();
42     source.buffer = createImpulseBuffer(context, bufferSize);
43
44     // The onaudioprocess function doesn't need to do anything.  We just need the process to start
45     // to test that implementation accepts 0 input channels.
46     //
47     // FIXME: check the .inputBuffer attribute of the AudioProcessingEvent.
48     node.onaudioprocess = function(e) { };
49     source.connect(node);
50     node.connect(context.destination);
51     source.start(0);
52
53     context.oncomplete = checkResult;
54     context.startRendering();
55 }
56
57 runTest();
58 </script>
59 </body>
60 </html>