test_scriptProcessorNodeNotConnected.html (1057B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test AudioBufferSourceNode: should not fire audioprocess if not connected.</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <script type="text/javascript" src="webaudio.js"></script> 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 8 </head> 9 <body> 10 <pre id="test"> 11 <script class="testbody" type="text/javascript"> 12 SimpleTest.waitForExplicitFinish(); 13 SimpleTest.requestFlakyTimeout("This test needs to wait a while to ensure that a given event does not happen."); 14 addLoadEvent(function() { 15 var context = new AudioContext(); 16 17 var sp = context.createScriptProcessor(2048, 2, 2); 18 sp.onaudioprocess = function() { 19 ok(false, "Should not call onaudioprocess if the node is not connected."); 20 sp.onaudioprocess = null; 21 SimpleTest.finish(); 22 }; 23 setTimeout(function() { 24 console.log(sp.onaudioprocess); 25 if (sp.onaudioprocess) { 26 ok(true, "onaudioprocess not fired."); 27 SimpleTest.finish(); 28 } 29 }, 4000); 30 }); 31 </script> 32 </pre> 33 </body> 34 </html>