OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Test AudioContext.close()</title> | 4 <title>Test AudioContext.close()</title> |
5 <script src="../resources/js-test.js"></script> | 5 <script src="../resources/js-test.js"></script> |
6 <script src="resources/compatibility.js"></script> | 6 <script src="resources/compatibility.js"></script> |
7 <script src="resources/audio-testing.js"></script> | 7 <script src="resources/audio-testing.js"></script> |
8 </head> | 8 </head> |
9 | 9 |
10 <body> | 10 <body> |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 }, | 104 }, |
105 function () { | 105 function () { |
106 testPassed("Closing context again correctly rejected promise."); | 106 testPassed("Closing context again correctly rejected promise."); |
107 // Finally, run GC. The context should be gone, but this seems difficu
lt to verify. | 107 // Finally, run GC. The context should be gone, but this seems difficu
lt to verify. |
108 gc(); | 108 gc(); |
109 shouldBeNull("context.destination"); | 109 shouldBeNull("context.destination"); |
110 } | 110 } |
111 ).then(done); | 111 ).then(done); |
112 }); | 112 }); |
113 | 113 |
| 114 // Task: test online context (4). |
| 115 audit.defineTask('test-online-context-4', function (done) { |
| 116 |
| 117 // Create a context and verify that its sampleRate and baseLatency return |
| 118 // valid values whether it's open or closed. |
| 119 shouldNotThrow("context = new AudioContext()"); |
| 120 shouldBeGreaterThan("context.sampleRate", "0"); |
| 121 shouldBeGreaterThan("context.baseLatency", "0"); |
| 122 |
| 123 context.close().then( |
| 124 function () { |
| 125 testPassed("context.close() was correctly resolved"); |
| 126 shouldBeGreaterThan("context.sampleRate", "0"); |
| 127 shouldBeEqualToNumber("context.baseLatency", 0); |
| 128 }, |
| 129 function () { |
| 130 testFailed("context.close() was erroneously rejected"); |
| 131 } |
| 132 ).then(done); |
| 133 |
| 134 }); |
| 135 |
114 // Task: test offline context (1). | 136 // Task: test offline context (1). |
115 audit.defineTask('test-offline-context-1', function (done) { | 137 audit.defineTask('test-offline-context-1', function (done) { |
116 | 138 |
117 // For an offline context, verify that close is not defined. | 139 // For an offline context, verify that close is not defined. |
118 shouldNotThrow("offline = new OfflineAudioContext(1, 1000, 48000)"); | 140 shouldNotThrow("offline = new OfflineAudioContext(1, 1000, 48000)"); |
119 shouldBeEqualToString("offline.state", "suspended"); | 141 shouldBeEqualToString("offline.state", "suspended"); |
120 shouldBeUndefined("offline.close"); | 142 shouldBeUndefined("offline.close"); |
121 done(); | 143 done(); |
122 }); | 144 }); |
123 | 145 |
124 audit.defineTask('finish-test', function (done) { | 146 audit.defineTask('finish-test', function (done) { |
125 done(); | 147 done(); |
126 finishJSTest(); | 148 finishJSTest(); |
127 }); | 149 }); |
128 | 150 |
129 audit.runTasks(); | 151 audit.runTasks(); |
130 | 152 |
131 successfullyParsed = true; | 153 successfullyParsed = true; |
132 </script> | 154 </script> |
133 </body> | 155 </body> |
134 </html> | 156 </html> |
OLD | NEW |