Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / 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     if (window.testRunner) {
29         testRunner.dumpAsText();
30         testRunner.waitUntilDone();
31     }
32
33     window.jsTestIsAsync = true;
34
35     var context = new webkitOfflineAudioContext(1, renderLengthInFrames, sampleRate);
36
37     var node;
38
39     try {  
40         node = context.createJavaScriptNode(bufferSize, 0, 1);
41         testPassed("Successfully created JavaScriptAudioNode.");
42     } catch (e) {
43         testFailed("Failed to create JavaScriptAudioNode.");
44     }
45
46     var source = context.createBufferSource();
47     source.buffer = createImpulseBuffer(context, bufferSize);
48
49     // The onaudioprocess function doesn't need to do anything.  We just need the process to start
50     // to test that implementation accepts 0 input channels.
51     //
52     // FIXME: check the .inputBuffer attribute of the AudioProcessingEvent.
53     node.onaudioprocess = function(e) { };
54     source.connect(node);
55     node.connect(context.destination);
56     source.noteOn(0);
57
58     context.oncomplete = checkResult;
59     context.startRendering();
60 }
61
62 runTest();
63 successfullyParsed = true;
64 </script>
65     
66 </body>
67 </html>