Update selection handle position in Ref-Internet browser
[framework/web/webkit-efl.git] / LayoutTests / webaudio / mediaelementaudiosourcenode.html
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5 <script src="../fast/js/resources/js-test-pre.js"></script>
6 <script src="resources/audio-testing.js"></script>
7 </head>
8
9 <body>
10 <div id="description"></div>
11 <div id="console"></div>
12
13 <script>
14 description("Basic tests for MediaElementAudioSourceNode API.");
15
16 var context = 0;
17
18 function runTest() {
19     if (window.testRunner) {
20         testRunner.dumpAsText();
21         testRunner.waitUntilDone();
22     }
23     
24     window.jsTestIsAsync = true;
25
26     context = new webkitAudioContext();
27
28     audioElement = new Audio();
29     mediaSource = context.createMediaElementSource(audioElement);
30     window.audioNode = mediaSource;
31
32     // Check number of inputs and outputs.
33     if (audioNode.numberOfInputs == 0)
34         testPassed("Source AudioNode has no inputs.");
35     else
36         testFailed("Source AudioNode should not have inputs.");
37     
38     if (audioNode.numberOfOutputs == 1)
39         testPassed("Source AudioNode has one output.");
40     else
41         testFailed("Source AudioNode should have one output.");
42
43     // Try calling connect() method with illegal values.
44
45     try {
46         audioNode.connect(0, 0, 0);
47         testFailed("connect() exception should be thrown for illegal destination AudioNode.");
48     } catch(e) {
49         testPassed("connect() exception thrown for illegal destination AudioNode.");
50     }
51
52     try {
53         audioNode.connect(context.destination, 5, 0);
54         testFailed("connect() exception should be thrown for illegal output index.");
55     } catch(e) {
56         testPassed("connect() exception thrown for illegal output index.");
57     }
58
59     try {
60         audioNode.connect(context.destination, 0, 5);
61         testFailed("connect() exception should be thrown for illegal input index.");
62     } catch(e) {
63         testPassed("connect() exception thrown for illegal input index.");
64     }
65
66     // Try calling connect() with proper values.
67     try {
68         audioNode.connect(context.destination, 0, 0);
69         testPassed("audioNode.connect(context.destination) succeeded.");
70     } catch(e) {
71         testFailed("audioNode.connect(context.destination) failed.");
72     }
73     
74     // Try creating another MediaElementAudioSourceNode using the same audio element.
75     try {
76         mediaSource = context.createMediaElementSource(audioElement);
77         testFailed("createMediaElementSource() should throw if called twice on same HTMLMediaElement.");
78     } catch(e) {
79         testPassed("createMediaElementSource() threw error when called twice on same HTMLMediaElement.");
80     }
81
82     finishJSTest();
83 }
84
85 runTest();
86
87 </script>
88
89 <script src="../fast/js/resources/js-test-post.js"></script>
90 </body>
91 </html>