OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 | 2 |
3 <html> | 3 <html> |
4 <head> | 4 <head> |
5 <script src="../fast/js/resources/js-test-pre.js"></script> | 5 <script src="../fast/js/resources/js-test-pre.js"></script> |
6 <script type="text/javascript" src="resources/audio-testing.js"></script> | 6 <script type="text/javascript" src="resources/audio-testing.js"></script> |
7 </head> | 7 </head> |
8 | 8 |
9 <body> | 9 <body> |
10 <div id="description"></div> | 10 <div id="description"></div> |
11 <div id="console"></div> | 11 <div id="console"></div> |
12 | 12 |
13 <script> | 13 <script> |
14 description("Basic tests for AudioNode API."); | 14 description("Basic tests for AudioNode API."); |
15 | 15 |
16 var context = 0; | 16 var context = 0; |
17 var context2 = 0; | 17 var context2 = 0; |
| 18 var context3 = 0; |
18 | 19 |
19 function runTest() { | 20 function runTest() { |
20 if (window.testRunner) { | 21 if (window.testRunner) { |
21 testRunner.dumpAsText(); | 22 testRunner.dumpAsText(); |
22 testRunner.waitUntilDone(); | 23 testRunner.waitUntilDone(); |
23 } | 24 } |
24 | 25 |
25 window.jsTestIsAsync = true; | 26 window.jsTestIsAsync = true; |
26 | 27 |
27 context = new webkitAudioContext(); | 28 context = new webkitAudioContext(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 95 } |
95 | 96 |
96 // Create a new context with not enough arguments | 97 // Create a new context with not enough arguments |
97 try { | 98 try { |
98 context2 = new webkitAudioContext(0, 0); | 99 context2 = new webkitAudioContext(0, 0); |
99 testFailed("exception should be thrown when creating audio context with
not enough arguments."); | 100 testFailed("exception should be thrown when creating audio context with
not enough arguments."); |
100 } catch(e) { | 101 } catch(e) { |
101 testPassed("exception thrown when creating audio context with not enough
arguments."); | 102 testPassed("exception thrown when creating audio context with not enough
arguments."); |
102 } | 103 } |
103 | 104 |
| 105 // Create a new offline audio context using the deprecated AudioContext cons
tructor. |
| 106 shouldNotThrow("context3 = new webkitAudioContext(1, 44100, 44100)"); |
| 107 |
104 // Ensure it is an EventTarget | 108 // Ensure it is an EventTarget |
105 try { | 109 try { |
106 audioNode.addEventListener('testEvent', function(){ | 110 audioNode.addEventListener('testEvent', function(){ |
107 testPassed("AudioNode is an EventTarget"); | 111 testPassed("AudioNode is an EventTarget"); |
108 }); | 112 }); |
109 audioNode.dispatchEvent(new Event('testEvent')); | 113 audioNode.dispatchEvent(new Event('testEvent')); |
110 } catch(e) { | 114 } catch(e) { |
111 testFailed("exception shouldn't be thrown when testing whether audio nod
e is an event target"); | 115 testFailed("exception shouldn't be thrown when testing whether audio nod
e is an event target"); |
112 } | 116 } |
113 | 117 |
114 finishJSTest(); | 118 finishJSTest(); |
115 } | 119 } |
116 | 120 |
117 runTest(); | 121 runTest(); |
118 | 122 |
119 </script> | 123 </script> |
120 | 124 |
121 <script src="../fast/js/resources/js-test-post.js"></script> | 125 <script src="../fast/js/resources/js-test-post.js"></script> |
122 </body> | 126 </body> |
123 </html> | 127 </html> |
OLD | NEW |