test_badConnect.html (1524B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test whether we can create an AudioContext interface</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 7 </head> 8 <body> 9 <pre id="test"> 10 <script src="webaudio.js" type="text/javascript"></script> 11 <script class="testbody" type="text/javascript"> 12 13 SimpleTest.waitForExplicitFinish(); 14 addLoadEvent(function() { 15 var context1 = new OfflineAudioContext(1, 128, 44100); 16 var context2 = new OfflineAudioContext(1, 128, 44100); 17 18 var destination1 = context1.destination; 19 var destination2 = context2.destination; 20 var gain1 = new GainNode(context2); 21 22 isnot(destination1, destination2, "Destination nodes should not be the same"); 23 isnot(destination1.context, destination2.context, "Destination nodes should not have the same context"); 24 25 var source1 = context1.createBufferSource(); 26 27 expectException(function() { 28 source1.connect(destination1, 1); 29 }, DOMException.INDEX_SIZE_ERR); 30 expectException(function() { 31 source1.connect(destination1, 0, 1); 32 }, DOMException.INDEX_SIZE_ERR); 33 expectException(function() { 34 source1.connect(destination2); 35 }, DOMException.INVALID_ACCESS_ERR); 36 expectException(function() { 37 source1.connect(gain1.gain); 38 }, DOMException.INVALID_ACCESS_ERR); 39 40 source1.connect(destination1); 41 42 expectException(function() { 43 source1.disconnect(1); 44 }, DOMException.INDEX_SIZE_ERR); 45 46 SimpleTest.finish(); 47 }); 48 49 </script> 50 </pre> 51 </body> 52 </html>