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/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
7 <script src="../resources/audit-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
8 <script src="../resources/audit.js"></script> | 8 <script src="../resources/audit.js"></script> |
9 </head> | 9 </head> |
10 | 10 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // Finally, run GC. The context should be gone, but this seems | 130 // Finally, run GC. The context should be gone, but this seems |
131 // difficult to verify. | 131 // difficult to verify. |
132 if (window.gc) | 132 if (window.gc) |
133 gc(); | 133 gc(); |
134 should(context.destination, "context.destination") | 134 should(context.destination, "context.destination") |
135 .beEqualTo(null); | 135 .beEqualTo(null); |
136 }) | 136 }) |
137 .then(task.done.bind(task)); | 137 .then(task.done.bind(task)); |
138 }); | 138 }); |
139 | 139 |
| 140 // Task: test online context (4). |
| 141 audit.define('test-online-context-4', function (task, should) { |
| 142 task.describe("Test closed online context 4"); |
| 143 // Create a context and verify that its sampleRate and baseLatency return |
| 144 // valid values whether it's open or closed. |
| 145 should(() => context = new AudioContext(), |
| 146 "context = new AudioContext()") |
| 147 .notThrow(); |
| 148 should(context.sampleRate, "context.sampleRate") |
| 149 .beGreaterThan("0"); |
| 150 should(context.sampleRate, "context.baseLatency") |
| 151 .beGreaterThan("0"); |
| 152 |
| 153 should(context.close(), "context.close()") |
| 154 .beResolved() |
| 155 .then(() => { |
| 156 should(context.sampleRate, "context.sampleRate") |
| 157 .beGreaterThan("0"); |
| 158 should(context.sampleRate, "context.baseLatency") |
| 159 .beGreaterThan("0"); |
| 160 }) |
| 161 .then(task.done.bind(task)); |
| 162 }); |
| 163 |
140 // Task: test offline context (1). | 164 // Task: test offline context (1). |
141 audit.define('test-offline-context-1', function (task, should) { | 165 audit.define('test-offline-context-1', function (task, should) { |
142 task.describe("Test offline context"); | 166 task.describe("Test offline context"); |
143 // For an offline context, verify that close is not defined. | 167 // For an offline context, verify that close is not defined. |
144 should(() => offline = new OfflineAudioContext(1, 1000, 48000), | 168 should(() => offline = new OfflineAudioContext(1, 1000, 48000), |
145 "offline = new OfflineAudioContext(1, 1000, 48000)") | 169 "offline = new OfflineAudioContext(1, 1000, 48000)") |
146 .notThrow(); | 170 .notThrow(); |
147 should(offline.state, "offline.state") | 171 should(offline.state, "offline.state") |
148 .beEqualTo("suspended"); | 172 .beEqualTo("suspended"); |
149 should(offline.close, "offline.close") | 173 should(offline.close, "offline.close") |
150 .beEqualTo(undefined); | 174 .beEqualTo(undefined); |
151 task.done(); | 175 task.done(); |
152 }); | 176 }); |
153 | 177 |
154 audit.run(); | 178 audit.run(); |
155 </script> | 179 </script> |
156 </body> | 180 </body> |
157 </html> | 181 </html> |
OLD | NEW |