5 <script src=
"../resources/js-test.js"></script>
6 <script src=
"resources/compatibility.js"></script>
7 <script src=
"resources/audio-testing.js"></script>
11 <div id=
"description"></div>
12 <div id=
"console"></div>
15 description("Basic tests for MediaElementAudioSourceNode API.");
22 window
.jsTestIsAsync
= true;
24 context
= new AudioContext();
26 audioElement
= new Audio();
27 mediaSource
= context
.createMediaElementSource(audioElement
);
28 audioNode
= mediaSource
;
30 // Check number of inputs and outputs.
31 shouldBeEqualToNumber("audioNode.numberOfInputs", 0);
32 shouldBeEqualToNumber("audioNode.numberOfOutputs", 1);
34 // Try calling connect() method with illegal values: illegal destination, illegal output index,
35 // and illegal input index.
36 shouldThrow("audioNode.connect(0, 0, 0)");
37 shouldThrow("audioNode.connect(context.destination, 5, 0)");
38 shouldThrow("audioNode.connect(context.destination, 0, 5)");
40 // Try calling connect() with proper values.
41 shouldNotThrow("audioNode.connect(context.destination, 0, 0)");
43 // Try creating another MediaElementAudioSourceNode using the same audio element.
44 shouldThrow("context.createMediaElementSource(audioElement)");