AudioContext createChannelMerger() method should have optional argument for number...
[WebKit-https.git] / LayoutTests / webaudio / audiochannelmerger-basic.html
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5 <script src="../fast/js/resources/js-test-pre.js"></script>
6 </head>
7
8 <body>
9
10 <div id="description"></div>
11 <div id="console"></div>
12
13 <script>
14 description("Basic tests for AudioChannelMerger.");
15
16 function runTest() {
17     if (window.layoutTestController) {
18         layoutTestController.dumpAsText();
19         layoutTestController.waitUntilDone();
20     }
21
22     window.jsTestIsAsync = true;
23
24     var context = new webkitAudioContext();
25
26     try {
27         var mergernode = context.createChannelMerger(0);
28         testFailed("Exception should be thrown for numberOfInputs <= 0.");
29     } catch(e) {
30         testPassed("Exception was thrown for numberOfInputs <= 0.");
31     }
32
33     try {
34         var mergernode = context.createChannelMerger(33);
35         testFailed("Exception should be thrown for numberOfInputs >= 32.");
36     } catch(e) {
37         testPassed("Exception was thrown for numberOfInputs >= 32.");
38     }
39
40     try {
41         var mergernode = context.createChannelMerger(32);
42         testPassed("AudioChannelMerger created successfully with numberOfInputs = 32.");
43     } catch(e) {
44         testFailed("Failed to create AudioChannelMerger with numberOfInputs = 32.");
45     }
46
47     try {
48         var mergernode = context.createChannelMerger();
49         testPassed("AudioChannelMerger created successfully with empty parameter.");
50     } catch(e) {
51         testFailed("Failed to create AudioChannelMerger with empty parameter.");
52     }
53
54     finishJSTest();
55 }
56
57 runTest();
58
59 </script>
60
61 <script src="../fast/js/resources/js-test-post.js"></script>
62 </body>
63 </html>