|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <head> |
|
4 <title>Test whether we can create an AudioContext interface</title> |
|
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
7 </head> |
|
8 <body> |
|
9 <pre id="test"> |
|
10 <script src="webaudio.js" type="text/javascript"></script> |
|
11 <script class="testbody" type="text/javascript"> |
|
12 |
|
13 SimpleTest.waitForExplicitFinish(); |
|
14 addLoadEvent(function() { |
|
15 var context1 = new AudioContext(); |
|
16 var context2 = new AudioContext(); |
|
17 |
|
18 var destination1 = context1.destination; |
|
19 var destination2 = context2.destination; |
|
20 |
|
21 isnot(destination1, destination2, "Destination nodes should not be the same"); |
|
22 isnot(destination1.context, destination2.context, "Destination nodes should not have the same context"); |
|
23 |
|
24 var source1 = context1.createBufferSource(); |
|
25 |
|
26 expectException(function() { |
|
27 source1.connect(destination1, 1); |
|
28 }, DOMException.INDEX_SIZE_ERR); |
|
29 expectException(function() { |
|
30 source1.connect(destination1, 0, 1); |
|
31 }, DOMException.INDEX_SIZE_ERR); |
|
32 expectException(function() { |
|
33 source1.connect(destination2); |
|
34 }, DOMException.SYNTAX_ERR); |
|
35 |
|
36 source1.connect(destination1); |
|
37 |
|
38 expectException(function() { |
|
39 source1.disconnect(1); |
|
40 }, DOMException.INDEX_SIZE_ERR); |
|
41 |
|
42 SimpleTest.finish(); |
|
43 }); |
|
44 |
|
45 </script> |
|
46 </pre> |
|
47 </body> |
|
48 </html> |