Set input method state when webpage move by history
[framework/web/webkit-efl.git] / LayoutTests / webaudio / audionode.html
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5 <script src="../fast/js/resources/js-test-pre.js"></script>
6 <script type="text/javascript" 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 AudioNode API.");
15
16 var context = 0;
17 var context2 = 0;
18
19 function runTest() {
20     if (window.testRunner) {
21         testRunner.dumpAsText();
22         testRunner.waitUntilDone();
23     }
24     
25     window.jsTestIsAsync = true;
26
27     context = new webkitAudioContext();
28     window.audioNode = context.createBufferSource();
29
30     shouldThrow("audioNode.noteOn()");
31     shouldThrow("audioNode.noteGrainOn()");
32     shouldThrow("audioNode.noteOff()");
33
34     // Check input and output numbers of AudioSourceNode.
35     if (audioNode.numberOfInputs === 0)
36         testPassed("Source AudioNode has no inputs.");
37     else
38         testFailed("Source AudioNode should not have inputs.");
39     
40     if (audioNode.numberOfOutputs === 1)
41         testPassed("Source AudioNode has one output.");
42     else
43         testFailed("Source AudioNode should have one output.");
44
45     // Check input and output numbers of AudioDestinationNode
46     if (context.destination.numberOfInputs === 1)
47         testPassed("Destination AudioNode has one input.");
48     else
49         testFailed("Destination AudioNode should have one input.");
50
51     if (context.destination.numberOfOutputs === 0)
52         testPassed("Destination AudioNode has no outputs.");
53     else
54         testFailed("Destination AudioNode should have no outputs.");
55
56     // Try calling connect() method with illegal values.
57
58     try {
59         audioNode.connect(0, 0, 0);
60         testFailed("connect() exception should be thrown for illegal destination AudioNode.");
61     } catch(e) {
62         testPassed("connect() exception thrown for illegal destination AudioNode.");
63     }
64
65     try {
66         audioNode.connect(context.destination, 5, 0);
67         testFailed("connect() exception should be thrown for illegal output index.");
68     } catch(e) {
69         testPassed("connect() exception thrown for illegal output index.");
70     }
71
72     try {
73         audioNode.connect(context.destination, 0, 5);
74         testFailed("connect() exception should be thrown for illegal input index.");
75     } catch(e) {
76         testPassed("connect() exception thrown for illegal input index.");
77     }
78
79     // Try calling connect() with proper values.
80     try {
81         audioNode.connect(context.destination, 0, 0);
82         testPassed("audioNode.connect(context.destination) succeeded.");
83     } catch(e) {
84         testFailed("audioNode.connect(context.destination) failed.");
85     }
86     
87     // Create a new context and try to connect the other context's node to this one.
88     try {
89         context2 = new webkitAudioContext();
90         window.audioNode.connect(context2.destination);
91         testFailed("exception should be thrown when connecting to other context's node.");
92     } catch(e) {
93         testPassed("exception thrown when connecting to other context's node.");
94     }
95
96     // Create a new context with not enough arguments
97     try {
98         context2 = new webkitAudioContext(0, 0);
99         testFailed("exception should be thrown when creating audio context with not enough arguments.");
100     } catch(e) {
101         testPassed("exception thrown when creating audio context with not enough arguments.");
102     }
103
104     finishJSTest();
105 }
106
107 runTest();
108
109 </script>
110
111 <script src="../fast/js/resources/js-test-post.js"></script>
112 </body>
113 </html>