5 <script src="../fast/js/resources/js-test-pre.js"></script>
6 <script type="text/javascript" src="resources/audio-testing.js"></script>
10 <div id="description"></div>
11 <div id="console"></div>
14 description("Basic tests for AudioNode API.");
20 if (window.layoutTestController) {
21 layoutTestController.dumpAsText();
22 layoutTestController.waitUntilDone();
25 window.jsTestIsAsync = true;
27 context = new webkitAudioContext();
28 window.audioNode = context.createBufferSource();
30 shouldThrow("audioNode.noteOn()");
31 shouldThrow("audioNode.noteGrainOn()");
32 shouldThrow("audioNode.noteOff()");
34 // Check number of inputs and outputs.
35 if (audioNode.numberOfInputs == 0)
36 testPassed("Source AudioNode has no inputs.");
38 testFailed("Source AudioNode should not have inputs.");
40 if (audioNode.numberOfOutputs == 1)
41 testPassed("Source AudioNode has one output.");
43 testFailed("Source AudioNode should have one output.");
45 // Try calling connect() method with illegal values.
48 audioNode.connect(0, 0, 0);
49 testFailed("connect() exception should be thrown for illegal destination AudioNode.");
51 testPassed("connect() exception thrown for illegal destination AudioNode.");
55 audioNode.connect(context.destination, 5, 0);
56 testFailed("connect() exception should be thrown for illegal output index.");
58 testPassed("connect() exception thrown for illegal output index.");
62 audioNode.connect(context.destination, 0, 5);
63 testFailed("connect() exception should be thrown for illegal input index.");
65 testPassed("connect() exception thrown for illegal input index.");
68 // Try calling connect() with proper values.
70 audioNode.connect(context.destination, 0, 0);
71 testPassed("audioNode.connect(context.destination) succeeded.");
73 testFailed("audioNode.connect(context.destination) failed.");
76 // Create a new context and try to connect the other context's node to this one.
78 context2 = new webkitAudioContext();
79 window.audioNode.connect(context2.destination);
80 testFailed("exception should be thrown when connecting to other context's node.");
82 testPassed("exception thrown when connecting to other context's node.");
92 <script src="../fast/js/resources/js-test-post.js"></script>