| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../resources/js-test.js"></script> | |
| 5 <script src="resources/compatibility.js"></script> | |
| 6 <script src="resources/audit-util.js"></script> | |
| 7 <script src="resources/audio-testing.js"></script> | |
| 8 </head> | |
| 9 | |
| 10 <body> | |
| 11 <div id="description"></div> | |
| 12 <div id="console"></div> | |
| 13 | |
| 14 <script> | |
| 15 description("Tests that ScriptProcessorNode accepts 0 input channels."); | |
| 16 | |
| 17 var sampleRate = 44100.0; | |
| 18 var renderLengthInFrames = 512; | |
| 19 var bufferSize = 512; | |
| 20 | |
| 21 function checkResult(e) | |
| 22 { | |
| 23 testPassed("ScriptProcessorNode accepts 0 input channels."); | |
| 24 | |
| 25 finishJSTest(); | |
| 26 } | |
| 27 | |
| 28 function runTest() | |
| 29 { | |
| 30 if (window.testRunner) { | |
| 31 testRunner.dumpAsText(); | |
| 32 testRunner.waitUntilDone(); | |
| 33 } | |
| 34 | |
| 35 window.jsTestIsAsync = true; | |
| 36 | |
| 37 var context = new OfflineAudioContext(1, renderLengthInFrames, sampleRate); | |
| 38 | |
| 39 var node; | |
| 40 | |
| 41 try { | |
| 42 node = context.createScriptProcessor(bufferSize, 0, 1); | |
| 43 testPassed("Successfully created ScriptProcessorNode."); | |
| 44 } catch (e) { | |
| 45 testFailed("Failed to create ScriptProcessorNode."); | |
| 46 } | |
| 47 | |
| 48 var source = context.createBufferSource(); | |
| 49 source.buffer = createImpulseBuffer(context, bufferSize); | |
| 50 | |
| 51 // The onaudioprocess function doesn't need to do anything. We just need th
e process to start | |
| 52 // to test that implementation accepts 0 input channels. | |
| 53 // | |
| 54 // FIXME: check the .inputBuffer attribute of the AudioProcessingEvent. | |
| 55 node.onaudioprocess = function(e) { }; | |
| 56 source.connect(node); | |
| 57 node.connect(context.destination); | |
| 58 source.start(0); | |
| 59 | |
| 60 context.oncomplete = checkResult; | |
| 61 context.startRendering(); | |
| 62 } | |
| 63 | |
| 64 runTest(); | |
| 65 successfullyParsed = true; | |
| 66 </script> | |
| 67 | |
| 68 </body> | |
| 69 </html> | |
| OLD | NEW |