Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / scriptprocessornode-zero-input-channels.html
blobe54a603f98c5c241dfdda40dfabd576d007211c0
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <script src="resources/compatibility.js"></script>
5 <script src="resources/audio-testing.js"></script>
6 <script src="../resources/js-test.js"></script>
7 </head>
9 <body>
10 <div id="description"></div>
11 <div id="console"></div>
13 <script>
14 description("Tests that ScriptProcessorNode accepts 0 input channels.");
16 var sampleRate = 44100.0;
17 var renderLengthInFrames = 512;
18 var bufferSize = 512;
20 function checkResult(e)
22 testPassed("ScriptProcessorNode accepts 0 input channels.");
24 finishJSTest();
27 function runTest()
29 if (window.testRunner) {
30 testRunner.dumpAsText();
31 testRunner.waitUntilDone();
34 window.jsTestIsAsync = true;
36 var context = new OfflineAudioContext(1, renderLengthInFrames, sampleRate);
38 var node;
40 try {
41 node = context.createScriptProcessor(bufferSize, 0, 1);
42 testPassed("Successfully created ScriptProcessorNode.");
43 } catch (e) {
44 testFailed("Failed to create ScriptProcessorNode.");
47 var source = context.createBufferSource();
48 source.buffer = createImpulseBuffer(context, bufferSize);
50 // The onaudioprocess function doesn't need to do anything. We just need the process to start
51 // to test that implementation accepts 0 input channels.
53 // FIXME: check the .inputBuffer attribute of the AudioProcessingEvent.
54 node.onaudioprocess = function(e) { };
55 source.connect(node);
56 node.connect(context.destination);
57 source.start(0);
59 context.oncomplete = checkResult;
60 context.startRendering();
63 runTest();
64 successfullyParsed = true;
65 </script>
67 </body>
68 </html>