OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 | |
3 <html> | |
4 <head> | |
5 <script src="../resources/js-test.js"></script> | |
6 <script src="resources/compatibility.js"></script> | |
7 <script src="resources/audit-util.js"></script> | |
8 <script src="resources/audio-testing.js"></script> | |
9 </head> | |
10 | |
11 <body> | |
12 <div id="description"></div> | |
13 <div id="console"></div> | |
14 | |
15 <script> | |
16 description("Basic tests for MediaElementAudioSourceNode API."); | |
17 | |
18 var context = 0; | |
19 var audioElement = 0; | |
20 var audioNode = 0; | |
21 | |
22 function runTest() { | |
23 window.jsTestIsAsync = true; | |
24 | |
25 context = new AudioContext(); | |
26 | |
27 audioElement = new Audio(); | |
28 mediaSource = context.createMediaElementSource(audioElement); | |
29 audioNode = mediaSource; | |
30 | |
31 // Check number of inputs and outputs. | |
32 shouldBeEqualToNumber("audioNode.numberOfInputs", 0); | |
33 shouldBeEqualToNumber("audioNode.numberOfOutputs", 1); | |
34 | |
35 // Try calling connect() method with illegal values: illegal destination, il
legal output index, | |
36 // and illegal input index. | |
37 shouldThrow("audioNode.connect(0, 0, 0)"); | |
38 shouldThrow("audioNode.connect(context.destination, 5, 0)"); | |
39 shouldThrow("audioNode.connect(context.destination, 0, 5)"); | |
40 | |
41 // Try calling connect() with proper values. | |
42 shouldNotThrow("audioNode.connect(context.destination, 0, 0)"); | |
43 | |
44 // Try creating another MediaElementAudioSourceNode using the same audio ele
ment. | |
45 shouldThrow("context.createMediaElementSource(audioElement)"); | |
46 | |
47 finishJSTest(); | |
48 } | |
49 | |
50 runTest(); | |
51 | |
52 </script> | |
53 | |
54 </body> | |
55 </html> | |
OLD | NEW |