5 <script src="../fast/js/resources/js-test-pre.js"></script>
6 <script src="resources/audio-testing.js"></script>
10 <div id="description"></div>
11 <div id="console"></div>
14 description("Basic tests for MediaElementAudioSourceNode API.");
19 if (window.testRunner) {
20 testRunner.dumpAsText();
21 testRunner.waitUntilDone();
24 window.jsTestIsAsync = true;
26 context = new webkitAudioContext();
28 audioElement = new Audio();
29 mediaSource = context.createMediaElementSource(audioElement);
30 window.audioNode = mediaSource;
32 // Check number of inputs and outputs.
33 if (audioNode.numberOfInputs == 0)
34 testPassed("Source AudioNode has no inputs.");
36 testFailed("Source AudioNode should not have inputs.");
38 if (audioNode.numberOfOutputs == 1)
39 testPassed("Source AudioNode has one output.");
41 testFailed("Source AudioNode should have one output.");
43 // Try calling connect() method with illegal values.
46 audioNode.connect(0, 0, 0);
47 testFailed("connect() exception should be thrown for illegal destination AudioNode.");
49 testPassed("connect() exception thrown for illegal destination AudioNode.");
53 audioNode.connect(context.destination, 5, 0);
54 testFailed("connect() exception should be thrown for illegal output index.");
56 testPassed("connect() exception thrown for illegal output index.");
60 audioNode.connect(context.destination, 0, 5);
61 testFailed("connect() exception should be thrown for illegal input index.");
63 testPassed("connect() exception thrown for illegal input index.");
66 // Try calling connect() with proper values.
68 audioNode.connect(context.destination, 0, 0);
69 testPassed("audioNode.connect(context.destination) succeeded.");
71 testFailed("audioNode.connect(context.destination) failed.");
74 // Try creating another MediaElementAudioSourceNode using the same audio element.
76 mediaSource = context.createMediaElementSource(audioElement);
77 testFailed("createMediaElementSource() should throw if called twice on same HTMLMediaElement.");
79 testPassed("createMediaElementSource() threw error when called twice on same HTMLMediaElement.");
89 <script src="../fast/js/resources/js-test-post.js"></script>