| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../resources/testharness.js"></script> | 4 <script src="../resources/testharness.js"></script> |
| 5 <script src="../resources/testharnessreport.js"></script> | 5 <script src="../resources/testharnessreport.js"></script> |
| 6 <script src="resources/audit-util.js"></script> | 6 <script src="resources/audit-util.js"></script> |
| 7 <script src="resources/audit.js"></script> | 7 <script src="resources/audit.js"></script> |
| 8 <script src="resources/biquad-testing.js"></script> | 8 <script src="resources/biquad-testing.js"></script> |
| 9 </head> | 9 </head> |
| 10 | 10 |
| 11 <body> | 11 <body> |
| 12 <script> | 12 <script> |
| 13 let audit = Audit.createTaskRunner({requireResultFile: true}); | 13 let audit = Audit.createTaskRunner(); |
| 14 | 14 |
| 15 let otherContext; | 15 let otherContext; |
| 16 let node; | 16 let node; |
| 17 let node2; | 17 let node2; |
| 18 let mode; | 18 let mode; |
| 19 let panner; | 19 let panner; |
| 20 let script; | 20 let script; |
| 21 let source; |
| 21 | 22 |
| 22 function shouldThrowAndBeUnchanged(should, node, attr, value) { | 23 function shouldThrowAndBeUnchanged(should, node, attr, value) { |
| 23 should( | 24 should( |
| 24 () => node[attr] = value, | 25 () => node[attr] = value, |
| 25 node.constructor.name + '.' + attr + ' = ' + value) | 26 node.constructor.name + '.' + attr + ' = ' + value) |
| 26 .throw(); | 27 .throw(); |
| 27 should(node[attr], node.constructor.name + '.' + attr).notBeEqualTo(value); | 28 should(node[attr], node.constructor.name + '.' + attr).notBeEqualTo(value); |
| 28 } | 29 } |
| 29 | 30 |
| 30 audit.define('initialize', (task, should) => { | 31 audit.define( |
| 31 task.describe('Initialize contexts for testing'); | 32 {label: 'initialize', description: 'Initialize contexts for testing'}, |
| 33 (task, should) => { |
| 32 | 34 |
| 33 should(() => { | 35 should(() => { |
| 34 context = new AudioContext(); | 36 context = new AudioContext(); |
| 35 }, 'context = new AudioContext()').notThrow(); | 37 }, 'context = new AudioContext()').notThrow(); |
| 36 | 38 |
| 37 should(() => { | 39 should(() => { |
| 38 otherContext = new AudioContext(); }, | 40 otherContext = new AudioContext(); |
| 39 'otherContext = new AudioContext()') | 41 }, 'otherContext = new AudioContext()').notThrow(); |
| 40 .notThrow(); | |
| 41 | 42 |
| 42 task.done(); | 43 task.done(); |
| 43 }); | 44 }); |
| 44 | 45 |
| 45 audit.define('createBuffer', (task, should) => { | 46 audit.define('createBuffer', (task, should) => { |
| 46 task.describe('createBuffer'); | |
| 47 | |
| 48 // Invalid number of channels: NotSupportedError | 47 // Invalid number of channels: NotSupportedError |
| 49 should( | 48 should( |
| 50 () => context.createBuffer(99, 1, context.sampleRate), | 49 () => context.createBuffer(99, 1, context.sampleRate), |
| 51 'context.createBuffer(99, 1, context.sampleRate)') | 50 'context.createBuffer(99, 1, context.sampleRate)') |
| 52 .throw('NotSupportedError'); | 51 .throw('NotSupportedError'); |
| 53 should( | 52 should( |
| 54 () => context.createBuffer(0, 1, context.sampleRate), | 53 () => context.createBuffer(0, 1, context.sampleRate), |
| 55 'context.createBuffer(0, 1, context.sampleRate)') | 54 'context.createBuffer(0, 1, context.sampleRate)') |
| 56 .throw('NotSupportedError'); | 55 .throw('NotSupportedError'); |
| 57 // Invalid sample rate: NotSupportedError | 56 // Invalid sample rate: NotSupportedError |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // 2-arg createBuffer not allowed. | 88 // 2-arg createBuffer not allowed. |
| 90 should( | 89 should( |
| 91 () => context.createBuffer(new ArrayBuffer(100), true), | 90 () => context.createBuffer(new ArrayBuffer(100), true), |
| 92 'context.createBuffer(new ArrayBuffer(100), true)') | 91 'context.createBuffer(new ArrayBuffer(100), true)') |
| 93 .throw('TypeError'); | 92 .throw('TypeError'); |
| 94 | 93 |
| 95 task.done(); | 94 task.done(); |
| 96 }); | 95 }); |
| 97 | 96 |
| 98 audit.define('createMediaElementSource', (task, should) => { | 97 audit.define('createMediaElementSource', (task, should) => { |
| 99 task.describe('createMediaElementSource'); | |
| 100 | |
| 101 // Invalid sources (unspecified error) | 98 // Invalid sources (unspecified error) |
| 102 should( | 99 should( |
| 103 () => context.createMediaElementSource(null), | 100 () => context.createMediaElementSource(null), |
| 104 'context.createMediaElementSource(null)') | 101 'context.createMediaElementSource(null)') |
| 105 .throw(); | 102 .throw(); |
| 106 task.done(); | 103 task.done(); |
| 107 }); | 104 }); |
| 108 | 105 |
| 109 audit.define('createMediaStreamSource', (task, should) => { | 106 audit.define('createMediaStreamSource', (task, should) => { |
| 110 task.describe('createMediaStreamSource'); | |
| 111 | |
| 112 // Invalid sources (unspecified error) | 107 // Invalid sources (unspecified error) |
| 113 should( | 108 should( |
| 114 () => context.createMediaStreamSource(null), | 109 () => context.createMediaStreamSource(null), |
| 115 'context.createMediaStreamSource(null)') | 110 'context.createMediaStreamSource(null)') |
| 116 .throw(); | 111 .throw(); |
| 117 | 112 |
| 118 task.done(); | 113 task.done(); |
| 119 }); | 114 }); |
| 120 | 115 |
| 121 audit.define('createScriptProcessor', (task, should) => { | 116 audit.define('createScriptProcessor', (task, should) => { |
| 122 task.describe('createScriptProcessor'); | |
| 123 | |
| 124 // Invalid buffer size: IndexSizeError | 117 // Invalid buffer size: IndexSizeError |
| 125 should( | 118 should( |
| 126 () => context.createScriptProcessor(1, 1, 1), | 119 () => context.createScriptProcessor(1, 1, 1), |
| 127 'context.createScriptProcessor(1, 1, 1)') | 120 'context.createScriptProcessor(1, 1, 1)') |
| 128 .throw('IndexSizeError'); | 121 .throw('IndexSizeError'); |
| 129 // Invalid number of inputs and outputs: IndexSizeError | 122 // Invalid number of inputs and outputs: IndexSizeError |
| 130 should( | 123 should( |
| 131 () => context.createScriptProcessor(4096, 100, 1), | 124 () => context.createScriptProcessor(4096, 100, 1), |
| 132 'context.createScriptProcessor(4096, 100, 1)') | 125 'context.createScriptProcessor(4096, 100, 1)') |
| 133 .throw('IndexSizeError'); | 126 .throw('IndexSizeError'); |
| 134 should( | 127 should( |
| 135 () => context.createScriptProcessor(4096, 1, 100), | 128 () => context.createScriptProcessor(4096, 1, 100), |
| 136 'context.createScriptProcessor(4096, 1, 100)') | 129 'context.createScriptProcessor(4096, 1, 100)') |
| 137 .throw('IndexSizeError'); | 130 .throw('IndexSizeError'); |
| 138 should( | 131 should( |
| 139 () => context.createScriptProcessor(), 'context.createScriptProcessor()') | 132 () => context.createScriptProcessor(), 'context.createScriptProcessor()') |
| 140 .notThrow(); | 133 .notThrow(); |
| 141 should( | 134 should( |
| 142 () => context.createScriptProcessor(0), | 135 () => context.createScriptProcessor(0), |
| 143 'context.createScriptProcessor(0)') | 136 'context.createScriptProcessor(0)') |
| 144 .notThrow(); | 137 .notThrow(); |
| 145 | 138 |
| 146 task.done(); | 139 task.done(); |
| 147 }); | 140 }); |
| 148 | 141 |
| 149 audit.define('createChannelSplitter', (task, should) => { | 142 audit.define('createChannelSplitter', (task, should) => { |
| 150 task.describe('createChannelSplitter'); | |
| 151 | |
| 152 // Invalid number of channels: IndexSizeError | 143 // Invalid number of channels: IndexSizeError |
| 153 should( | 144 should( |
| 154 () => context.createChannelSplitter(0), | 145 () => context.createChannelSplitter(0), |
| 155 'context.createChannelSplitter(0)') | 146 'context.createChannelSplitter(0)') |
| 156 .throw('IndexSizeError'); | 147 .throw('IndexSizeError'); |
| 157 should( | 148 should( |
| 158 () => context.createChannelSplitter(99), | 149 () => context.createChannelSplitter(99), |
| 159 'context.createChannelSplitter(99)') | 150 'context.createChannelSplitter(99)') |
| 160 .throw('IndexSizeError'); | 151 .throw('IndexSizeError'); |
| 161 should(() => context.createChannelMerger(0), 'context.createChannelMerger(0)') | 152 should(() => context.createChannelMerger(0), 'context.createChannelMerger(0)') |
| 162 .throw('IndexSizeError'); | 153 .throw('IndexSizeError'); |
| 163 | 154 |
| 164 task.done(); | 155 task.done(); |
| 165 }); | 156 }); |
| 166 | 157 |
| 167 audit.define('createChannelMerger', (task, should) => { | 158 audit.define('createChannelMerger', (task, should) => { |
| 168 task.describe('createChannelMerger'); | |
| 169 | |
| 170 // Invalid number of channels: IndexSizeError | 159 // Invalid number of channels: IndexSizeError |
| 171 should( | 160 should( |
| 172 () => context.createChannelMerger(99), 'context.createChannelMerger(99)') | 161 () => context.createChannelMerger(99), 'context.createChannelMerger(99)') |
| 173 .throw('IndexSizeError'); | 162 .throw('IndexSizeError'); |
| 174 | 163 |
| 175 task.done(); | 164 task.done(); |
| 176 }); | 165 }); |
| 177 | 166 |
| 178 audit.define('createPeriodicWave', (task, should) => { | 167 audit.define('createPeriodicWave', (task, should) => { |
| 179 task.describe('createPeriodicWave'); | |
| 180 | |
| 181 // Invalid real/imag arrays: IndexSizeError | 168 // Invalid real/imag arrays: IndexSizeError |
| 182 should( | 169 should( |
| 183 () => context.createPeriodicWave(null, null), | 170 () => context.createPeriodicWave(null, null), |
| 184 'context.createPeriodicWave(null, null)') | 171 'context.createPeriodicWave(null, null)') |
| 185 .throw('TypeError'); | 172 .throw('TypeError'); |
| 186 should( | 173 should( |
| 187 () => context.createPeriodicWave(new Float32Array(10), null), | 174 () => context.createPeriodicWave(new Float32Array(10), null), |
| 188 'context.createPeriodicWave(new Float32Array(10), null)') | 175 'context.createPeriodicWave(new Float32Array(10), null)') |
| 189 .throw('TypeError'); | 176 .throw('TypeError'); |
| 190 // Verify that we can use large arrays with no limit. Roughly. | 177 // Verify that we can use large arrays with no limit. Roughly. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 207 should( | 194 should( |
| 208 () => | 195 () => |
| 209 context.createPeriodicWave(new Float32Array(10), new Float32Array(7)), | 196 context.createPeriodicWave(new Float32Array(10), new Float32Array(7)), |
| 210 'context.createPeriodicWave(new Float32Array(10), new Float32Array(7))') | 197 'context.createPeriodicWave(new Float32Array(10), new Float32Array(7))') |
| 211 .throw('IndexSizeError'); | 198 .throw('IndexSizeError'); |
| 212 | 199 |
| 213 task.done(); | 200 task.done(); |
| 214 }); | 201 }); |
| 215 | 202 |
| 216 audit.define('createAnalyser', (task, should) => { | 203 audit.define('createAnalyser', (task, should) => { |
| 217 task.describe('createAnalyser'); | |
| 218 | |
| 219 // Analysers | 204 // Analysers |
| 220 node = context.createAnalyser(); | 205 node = context.createAnalyser(); |
| 221 // Invalid fftSize: IndexSizeError | 206 // Invalid fftSize: IndexSizeError |
| 222 shouldThrowAndBeUnchanged(should, node, 'fftSize', '42'); | 207 shouldThrowAndBeUnchanged(should, node, 'fftSize', '42'); |
| 223 shouldThrowAndBeUnchanged(should, node, 'fftSize', '16'); | 208 shouldThrowAndBeUnchanged(should, node, 'fftSize', '16'); |
| 224 should(() => node.fftSize = 32768, 'AnalyserNode.fftSize = 32768').notThrow(); | 209 should(() => node.fftSize = 32768, 'AnalyserNode.fftSize = 32768').notThrow(); |
| 225 shouldThrowAndBeUnchanged(should, node, 'fftSize', '65536'); | 210 shouldThrowAndBeUnchanged(should, node, 'fftSize', '65536'); |
| 226 | 211 |
| 227 shouldThrowAndBeUnchanged(should, node, 'minDecibels', '-10'); | 212 shouldThrowAndBeUnchanged(should, node, 'minDecibels', '-10'); |
| 228 shouldThrowAndBeUnchanged(should, node, 'maxDecibels', '-150'); | 213 shouldThrowAndBeUnchanged(should, node, 'maxDecibels', '-150'); |
| 229 shouldThrowAndBeUnchanged(should, node, 'minDecibels', '-30'); | 214 shouldThrowAndBeUnchanged(should, node, 'minDecibels', '-30'); |
| 230 shouldThrowAndBeUnchanged(should, node, 'maxDecibels', '-100'); | 215 shouldThrowAndBeUnchanged(should, node, 'maxDecibels', '-100'); |
| 231 | 216 |
| 232 shouldThrowAndBeUnchanged(should, node, 'smoothingTimeConstant', '-0.1'); | 217 shouldThrowAndBeUnchanged(should, node, 'smoothingTimeConstant', '-0.1'); |
| 233 shouldThrowAndBeUnchanged(should, node, 'smoothingTimeConstant', '1.5'); | 218 shouldThrowAndBeUnchanged(should, node, 'smoothingTimeConstant', '1.5'); |
| 234 | 219 |
| 235 should( | 220 should( |
| 236 () => node.getFloatFrequencyData(null), | 221 () => node.getFloatFrequencyData(null), |
| 237 'AnalyserNode.getFloatFrequencyData(null)') | 222 'AnalyserNode.getFloatFrequencyData(null)') |
| 238 .throw(); | 223 .throw(); |
| 239 should( | 224 should( |
| 240 () => node.getByteFrequencyData(null), node.constructor.name + '.getByteFr
equencyData(null)') | 225 () => node.getByteFrequencyData(null), |
| 226 node.constructor.name + '.getByteFrequencyData(null)') |
| 241 .throw(); | 227 .throw(); |
| 242 should( | 228 should( |
| 243 () => node.getFloatTimeDomainData(null), | 229 () => node.getFloatTimeDomainData(null), |
| 244 node.constructor.name + '.getFloatTimeDomainData(null)') | 230 node.constructor.name + '.getFloatTimeDomainData(null)') |
| 245 .throw(); | 231 .throw(); |
| 246 should( | 232 should( |
| 247 () => node.getByteTimeDomainData(null), | 233 () => node.getByteTimeDomainData(null), |
| 248 node.constructor.name + '.getByteTimeDomainData(null)') | 234 node.constructor.name + '.getByteTimeDomainData(null)') |
| 249 .throw(); | 235 .throw(); |
| 250 | 236 |
| 251 // AudioBuffers | 237 // AudioBuffers |
| 252 node = context.createBuffer(1, 1, context.sampleRate); | 238 node = context.createBuffer(1, 1, context.sampleRate); |
| 253 // Invalid channel index: IndexSizeError | 239 // Invalid channel index: IndexSizeError |
| 254 should(() => node.getChannelData(2), node.constructor.name + '.getChannelData(
2)').throw(); | |
| 255 | |
| 256 task.done(); | |
| 257 }); | |
| 258 | |
| 259 audit.define('Init test nodes', (task, should) => { | |
| 260 task.describe('Create test nodes'); | |
| 261 should(() => { node = context.createGain(); }, | |
| 262 'node = context.createGain()') | |
| 263 .notThrow(); | |
| 264 should(() => { node2 = context.createGain(); }, | |
| 265 'node2 = context.createGain()') | |
| 266 .notThrow(); | |
| 267 | |
| 268 task.done(); | |
| 269 }); | |
| 270 | |
| 271 audit.define('connections', (task, should) => { | |
| 272 task.describe('AudioNode connections'); | |
| 273 | |
| 274 // AudioNode connections | |
| 275 // Invalid destination node (unspecified error) | |
| 276 should(() => node.connect(null, 0, 0), 'node.connect(null, 0, 0)').throw(); | |
| 277 // Invalid input or output index: IndexSizeError | |
| 278 should( | 240 should( |
| 279 () => node.connect(context.destination, 100, 0), | 241 () => node.getChannelData(2), |
| 280 'node.connect(context.destination, 100, 0)') | 242 node.constructor.name + '.getChannelData(2)') |
| 281 .throw('IndexSizeError'); | |
| 282 should( | |
| 283 () => node.connect(context.destination, 0, 100), | |
| 284 'node.connect(context.destination, 0, 100)') | |
| 285 .throw('IndexSizeError'); | |
| 286 should(() => node.connect(node2.gain, 100), 'node.connect(node2.gain, 100)') | |
| 287 .throw('IndexSizeError'); | |
| 288 should(() => node.disconnect(99), 'node.disconnect(99)') | |
| 289 .throw('IndexSizeError'); | |
| 290 // Can't connect to a different context (unspecified error) | |
| 291 should( | |
| 292 () => node.connect(otherContext.destination), | |
| 293 'node.connect(otherContext.destination)') | |
| 294 .throw(); | 243 .throw(); |
| 295 | 244 |
| 296 task.done(); | 245 task.done(); |
| 297 }); | 246 }); |
| 298 | 247 |
| 299 audit.define('channel-stuff', (task, should) => { | 248 audit.define( |
| 300 task.describe('channelCount, channelCountMode, channelInterpretation'); | 249 { |
| 250 label: 'Init test nodes', |
| 251 description: 'Create test nodes for the following tests' |
| 252 }, |
| 253 (task, should) => { |
| 254 should(() => { |
| 255 node = context.createGain(); |
| 256 }, 'node = context.createGain()').notThrow(); |
| 257 should(() => { |
| 258 node2 = context.createGain(); |
| 259 }, 'node2 = context.createGain()').notThrow(); |
| 301 | 260 |
| 302 // Invalid channel count: NotSupportedError | 261 task.done(); |
| 303 shouldThrowAndBeUnchanged(should, node, 'channelCount', '99'); | 262 }); |
| 304 // Invalid mode or interpretation (unspecified error) | |
| 305 currentMode = node.channelCountMode; | |
| 306 currentInterpretation = node.channelInterpretation; | |
| 307 should( | |
| 308 () => node.channelCountMode = 'fancy', 'node.channelCountMode = "fancy"') | |
| 309 .notThrow(); | |
| 310 should(node.channelCountMode, 'node.channelCountMode').beEqualTo(currentMode); | |
| 311 should( | |
| 312 () => node.channelInterpretation = mode, | |
| 313 'node.channelInterpretation = mode') | |
| 314 .notThrow(); | |
| 315 should(node.channelInterpretation, 'node.channelInterpretation') | |
| 316 .beEqualTo(currentInterpretation); | |
| 317 // Destination node channel count: should throw IndexSizeError on invalid | |
| 318 // channel count. shouldNotThrow() method cannot be used because the error | |
| 319 // message includes the number of channels, which can change depending on | |
| 320 // the actual attached hardware. | |
| 321 should( | |
| 322 () => context.destination.channelCount = 99, | |
| 323 'context.destination.channelCount = 99') | |
| 324 .throw('IndexSizeError'); | |
| 325 | 263 |
| 326 task.done(); | 264 audit.define( |
| 327 }); | 265 {label: 'connections', description: 'AudioNode connections'}, |
| 266 (task, should) => { |
| 267 |
| 268 // AudioNode connections |
| 269 // Invalid destination node (unspecified error) |
| 270 should(() => node.connect(null, 0, 0), 'node.connect(null, 0, 0)') |
| 271 .throw(); |
| 272 // Invalid input or output index: IndexSizeError |
| 273 should( |
| 274 () => node.connect(context.destination, 100, 0), |
| 275 'node.connect(context.destination, 100, 0)') |
| 276 .throw('IndexSizeError'); |
| 277 should( |
| 278 () => node.connect(context.destination, 0, 100), |
| 279 'node.connect(context.destination, 0, 100)') |
| 280 .throw('IndexSizeError'); |
| 281 should( |
| 282 () => node.connect(node2.gain, 100), 'node.connect(node2.gain, 100)') |
| 283 .throw('IndexSizeError'); |
| 284 should(() => node.disconnect(99), 'node.disconnect(99)') |
| 285 .throw('IndexSizeError'); |
| 286 // Can't connect to a different context (unspecified error) |
| 287 should( |
| 288 () => node.connect(otherContext.destination), |
| 289 'node.connect(otherContext.destination)') |
| 290 .throw(); |
| 291 |
| 292 task.done(); |
| 293 }); |
| 294 |
| 295 audit.define( |
| 296 { |
| 297 label: 'channel-stuff', |
| 298 description: 'channelCount, channelCountMode, channelInterpretation' |
| 299 }, |
| 300 (task, should) => { |
| 301 |
| 302 // Invalid channel count: NotSupportedError |
| 303 shouldThrowAndBeUnchanged(should, node, 'channelCount', '99'); |
| 304 // Invalid mode or interpretation (unspecified error) |
| 305 currentMode = node.channelCountMode; |
| 306 currentInterpretation = node.channelInterpretation; |
| 307 should( |
| 308 () => node.channelCountMode = 'fancy', |
| 309 'node.channelCountMode = "fancy"') |
| 310 .notThrow(); |
| 311 should(node.channelCountMode, 'node.channelCountMode') |
| 312 .beEqualTo(currentMode); |
| 313 should( |
| 314 () => node.channelInterpretation = mode, |
| 315 'node.channelInterpretation = mode') |
| 316 .notThrow(); |
| 317 should(node.channelInterpretation, 'node.channelInterpretation') |
| 318 .beEqualTo(currentInterpretation); |
| 319 // Destination node channel count: should throw IndexSizeError on invalid |
| 320 // channel count. shouldNotThrow() method cannot be used because the error |
| 321 // message includes the number of channels, which can change depending on |
| 322 // the actual attached hardware. |
| 323 should( |
| 324 () => context.destination.channelCount = 99, |
| 325 'context.destination.channelCount = 99') |
| 326 .throw('IndexSizeError'); |
| 327 |
| 328 task.done(); |
| 329 }); |
| 328 | 330 |
| 329 audit.define('audioparam', (task, should) => { | 331 audit.define('audioparam', (task, should) => { |
| 330 task.describe('Simple AudioParam'); | |
| 331 | |
| 332 // AudioParams | 332 // AudioParams |
| 333 param = context.createGain().gain; | 333 param = context.createGain().gain; |
| 334 should( | 334 should( |
| 335 () => param.setValueCurveAtTime(null, 0, 0), | 335 () => param.setValueCurveAtTime(null, 0, 0), |
| 336 'param.setValueCurveAtTime(null, 0, 0)') | 336 'param.setValueCurveAtTime(null, 0, 0)') |
| 337 .throw(); | 337 .throw(); |
| 338 | 338 |
| 339 // exponentialRampToValue should throw only for "zero" target values. | 339 // exponentialRampToValue should throw only for "zero" target values. |
| 340 should( | 340 should( |
| 341 () => node.gain.exponentialRampToValueAtTime(-1, 0.1), | 341 () => node.gain.exponentialRampToValueAtTime(-1, 0.1), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 366 // converted to a single float. | 366 // converted to a single float. |
| 367 should( | 367 should( |
| 368 () => node.gain.exponentialRampToValueAtTime(Math.pow(2, -150), 0.1), | 368 () => node.gain.exponentialRampToValueAtTime(Math.pow(2, -150), 0.1), |
| 369 'node.gain.exponentialRampToValueAtTime(Math.pow(2, -150), 0.1)') | 369 'node.gain.exponentialRampToValueAtTime(Math.pow(2, -150), 0.1)') |
| 370 .throw(); | 370 .throw(); |
| 371 | 371 |
| 372 task.done(); | 372 task.done(); |
| 373 }); | 373 }); |
| 374 | 374 |
| 375 audit.define('biquad', (task, should) => { | 375 audit.define('biquad', (task, should) => { |
| 376 task.describe('BiquadFilter'); | |
| 377 | |
| 378 // BiquadFilterNode | 376 // BiquadFilterNode |
| 379 node = context.createBiquadFilter(); | 377 node = context.createBiquadFilter(); |
| 380 should( | 378 should( |
| 381 () => node.getFrequencyResponse( | 379 () => node.getFrequencyResponse( |
| 382 new Float32Array(1), new Float32Array(1), new Float32Array(1)), | 380 new Float32Array(1), new Float32Array(1), new Float32Array(1)), |
| 383 'node.getFrequencyResponse(new Float32Array(1), new Float32Array(1), new F
loat32Array(1))') | 381 'node.getFrequencyResponse(new Float32Array(1), new Float32Array(1), new F
loat32Array(1))') |
| 384 .notThrow(); | 382 .notThrow(); |
| 385 should( | 383 should( |
| 386 () => node.getFrequencyResponse( | 384 () => node.getFrequencyResponse( |
| 387 null, new Float32Array(1), new Float32Array(1)), | 385 null, new Float32Array(1), new Float32Array(1)), |
| 388 'node.getFrequencyResponse(null, new Float32Array(1), new Float32Array(1))
') | 386 'node.getFrequencyResponse(null, new Float32Array(1), new Float32Array(1))
') |
| 389 .throw(); | 387 .throw(); |
| 390 should( | 388 should( |
| 391 () => node.getFrequencyResponse( | 389 () => node.getFrequencyResponse( |
| 392 new Float32Array(1), null, new Float32Array(1)), | 390 new Float32Array(1), null, new Float32Array(1)), |
| 393 'node.getFrequencyResponse(new Float32Array(1), null, new Float32Array(1))
') | 391 'node.getFrequencyResponse(new Float32Array(1), null, new Float32Array(1))
') |
| 394 .throw(); | 392 .throw(); |
| 395 should( | 393 should( |
| 396 () => node.getFrequencyResponse( | 394 () => node.getFrequencyResponse( |
| 397 new Float32Array(1), new Float32Array(1), null), | 395 new Float32Array(1), new Float32Array(1), null), |
| 398 'node.getFrequencyResponse(new Float32Array(1), new Float32Array(1), null)
') | 396 'node.getFrequencyResponse(new Float32Array(1), new Float32Array(1), null)
') |
| 399 .throw(); | 397 .throw(); |
| 400 | 398 |
| 401 task.done(); | 399 task.done(); |
| 402 }); | 400 }); |
| 403 | 401 |
| 404 audit.define('offline-audio-context', (task, should) => { | 402 audit.define('offline-audio-context', (task, should) => { |
| 405 task.describe('OfflineAudioContext'); | |
| 406 | |
| 407 // OfflineAudioContext | 403 // OfflineAudioContext |
| 408 // Max supported channels | 404 // Max supported channels |
| 409 should( | 405 should( |
| 410 () => new OfflineAudioContext(32, 100, context.sampleRate), | 406 () => new OfflineAudioContext(32, 100, context.sampleRate), |
| 411 'new OfflineAudioContext(32, 100, context.sampleRate)') | 407 'new OfflineAudioContext(32, 100, context.sampleRate)') |
| 412 .notThrow(); | 408 .notThrow(); |
| 413 // Invalid number of channels (unspecified error) | 409 // Invalid number of channels (unspecified error) |
| 414 should( | 410 should( |
| 415 () => new OfflineAudioContext(99, 100, context.sampleRate), | 411 () => new OfflineAudioContext(99, 100, context.sampleRate), |
| 416 'new OfflineAudioContext(99, 100, context.sampleRate)') | 412 'new OfflineAudioContext(99, 100, context.sampleRate)') |
| (...skipping 10 matching lines...) Expand all Loading... |
| 427 // Invalid frame length (crbug.com/351277) | 423 // Invalid frame length (crbug.com/351277) |
| 428 should( | 424 should( |
| 429 () => new OfflineAudioContext(1, -88200000000000, 44100), | 425 () => new OfflineAudioContext(1, -88200000000000, 44100), |
| 430 'new OfflineAudioContext(1, -88200000000000, 44100)') | 426 'new OfflineAudioContext(1, -88200000000000, 44100)') |
| 431 .throw(); | 427 .throw(); |
| 432 | 428 |
| 433 task.done(); | 429 task.done(); |
| 434 }); | 430 }); |
| 435 | 431 |
| 436 audit.define('waveshaper', (task, should) => { | 432 audit.define('waveshaper', (task, should) => { |
| 437 task.describe('WaveShaper'); | |
| 438 | |
| 439 // WaveShaper types | 433 // WaveShaper types |
| 440 node = context.createWaveShaper(); | 434 node = context.createWaveShaper(); |
| 441 currentOversample = node.oversample; | 435 currentOversample = node.oversample; |
| 442 should(() => node.oversample = '9x', 'node.oversample = "9x"').notThrow(); | 436 should(() => node.oversample = '9x', 'node.oversample = "9x"').notThrow(); |
| 443 should(node.oversample, 'node.oversample').beEqualTo(currentOversample); | 437 should(node.oversample, 'node.oversample').beEqualTo(currentOversample); |
| 444 should(() => node.curve = {}, 'node.curve = {}').throw(); | 438 should(() => node.curve = {}, 'node.curve = {}').throw(); |
| 445 should( | 439 should( |
| 446 () => node.curve = new Float32Array(1), | 440 () => node.curve = new Float32Array(1), |
| 447 'node.curve = new Float32Array(1)') | 441 'node.curve = new Float32Array(1)') |
| 448 .throw(); | 442 .throw(); |
| 449 should(node.curve, 'node.curve').beEqualTo(null); | 443 should(node.curve, 'node.curve').beEqualTo(null); |
| 450 should( | 444 should( |
| 451 () => node.curve = new Float32Array(2), | 445 () => node.curve = new Float32Array(2), |
| 452 'node.curve = new Float32Array(2)') | 446 'node.curve = new Float32Array(2)') |
| 453 .notThrow(); | 447 .notThrow(); |
| 454 should(() => node.curve = null, 'node.curve = null').notThrow(); | 448 should(() => node.curve = null, 'node.curve = null').notThrow(); |
| 455 | 449 |
| 456 task.done(); | 450 task.done(); |
| 457 }); | 451 }); |
| 458 | 452 |
| 459 audit.define('audio-buffer-source', (task, should) => { | 453 audit.define( |
| 460 task.describe('AudioBufferSource start/stop'); | 454 {label: 'audio-buffer-source', description: 'AudioBufferSource start/stop'}, |
| 455 (task, should) => { |
| 456 // Start/stop for AudioBufferSourceNodes |
| 457 buffer = context.createBuffer(1, 1, context.sampleRate); |
| 458 should( |
| 459 () => source = context.createBufferSource(), |
| 460 'source = context.createBufferSource()') |
| 461 .notThrow(); |
| 462 should(() => { source.buffer = buffer}, 'source.buffer = buffer').notThrow
(); |
| 463 should( |
| 464 () => source.buffer = context.createBuffer(1, 10, context.sampleRate), |
| 465 'source.buffer = context.createBuffer(1, 10, context.sampleRate)') |
| 466 .throw(); |
| 467 should(() => {source.start(-1)}, 'source.start(-1)').throw(); |
| 468 should(() => {source.start(Infinity)}, 'source.start(Infinity)').throw(); |
| 469 should(() => {source.start(-Infinity)}, 'source.start(-Infinity)').throw()
; |
| 470 should(() => {source.start(NaN)}, 'source.start(NaN)').throw(); |
| 471 should(() => {source.start(1, Infinity)}, 'source.start(1, Infinity)') |
| 472 .throw(); |
| 473 should(() => {source.start(1, -Infinity)}, 'source.start(1, -Infinity)') |
| 474 .throw(); |
| 475 should(() => {source.start(1, NaN)}, 'source.start(1, NaN)').throw(); |
| 476 should(() => {source.start(1, -1)}, 'source.start(1, -1)').throw(); |
| 477 should( |
| 478 () => {source.start(1, -Number.MIN_VALUE)}, |
| 479 'source.start(1, -Number.MIN_VALUE)') |
| 480 .throw(); |
| 481 should(() => {source.start(1, 1, Infinity)}, 'source.start(1, 1, Infinity)
') |
| 482 .throw(); |
| 483 should( |
| 484 () => {source.start(1, 1, -Infinity)}, 'source.start(1, 1, -Infinity)'
) |
| 485 .throw(); |
| 486 should(() => {source.start(1, 1, NaN)}, 'source.start(1, 1, NaN)').throw()
; |
| 487 should(() => {source.start(1, 1, -1)}, 'source.start(1, 1, -1)').throw(); |
| 488 should( |
| 489 () => {source.start(1, 1, -Number.MIN_VALUE)}, |
| 490 'source.start(1, 1, -Number.MIN_VALUE)') |
| 491 .throw(); |
| 492 should(() => source.start(), 'source.start()').notThrow(); |
| 493 should( |
| 494 () => source.stop(-Number.MIN_VALUE), |
| 495 'source.stop(-Number.MIN_VALUE)') |
| 496 .throw(); |
| 497 should(() => source.stop(Infinity), 'source.stop(Infinity)').throw(); |
| 498 should(() => source.stop(-Infinity), 'source.stop(-Infinity)').throw(); |
| 499 should(() => source.stop(NaN), 'source.stop(NaN)').throw(); |
| 500 should(() => source.stop(), 'source.stop()').notThrow(); |
| 461 | 501 |
| 462 // Start/stop for AudioBufferSourceNodes | 502 // Verify that start(0, 0) doesn't signal. |
| 463 buffer = context.createBuffer(1, 1, context.sampleRate); | 503 let source2; |
| 464 should( | 504 should( |
| 465 () => source = context.createBufferSource(), | 505 () => { source2 = context.createBufferSource()}, |
| 466 'source = context.createBufferSource()') | 506 'source2 = context.createBufferSource()') |
| 467 .notThrow(); | 507 .notThrow(); |
| 468 should(() => source.buffer = buffer, 'source.buffer = buffer').notThrow(); | 508 should(() => source2.buffer = buffer, 'source2.buffer = buffer').notThrow(
); |
| 469 should( | 509 should(() => source2.start(0, 0), 'source2.start(0, 0)').notThrow(); |
| 470 () => source.buffer = context.createBuffer(1, 10, context.sampleRate), | |
| 471 'source.buffer = context.createBuffer(1, 10, context.sampleRate)') | |
| 472 .throw(); | |
| 473 should(() => source.start(-1), 'source.start(-1)').throw(); | |
| 474 should(() => source.start(Infinity), 'source.start(Infinity)').throw(); | |
| 475 should(() => source.start(-Infinity), 'source.start(-Infinity)').throw(); | |
| 476 should(() => source.start(NaN), 'source.start(NaN)').throw(); | |
| 477 should(() => source.start(1, Infinity), 'source.start(1, Infinity)').throw(); | |
| 478 should(() => source.start(1, -Infinity), 'source.start(1, -Infinity)') | |
| 479 .throw(); | |
| 480 should(() => source.start(1, NaN), 'source.start(1, NaN)').throw(); | |
| 481 should(() => source.start(1, -1), 'source.start(1, -1)').throw(); | |
| 482 should( | |
| 483 () => source.start(1, -Number.MIN_VALUE), | |
| 484 'source.start(1, -Number.MIN_VALUE)') | |
| 485 .throw(); | |
| 486 should(() => source.start(1, 1, Infinity), 'source.start(1, 1, Infinity)') | |
| 487 .throw(); | |
| 488 should(() => source.start(1, 1, -Infinity), 'source.start(1, 1, -Infinity)') | |
| 489 .throw(); | |
| 490 should(() => source.start(1, 1, NaN), 'source.start(1, 1, NaN)').throw(); | |
| 491 should(() => source.start(1, 1, -1), 'source.start(1, 1, -1)').throw(); | |
| 492 should( | |
| 493 () => source.start(1, 1, -Number.MIN_VALUE), | |
| 494 'source.start(1, 1, -Number.MIN_VALUE)') | |
| 495 .throw(); | |
| 496 should(() => source.start(), 'source.start()').notThrow(); | |
| 497 should(() => source.stop(-Number.MIN_VALUE), 'source.stop(-Number.MIN_VALUE)') | |
| 498 .throw(); | |
| 499 should(() => source.stop(Infinity), 'source.stop(Infinity)').throw(); | |
| 500 should(() => source.stop(-Infinity), 'source.stop(-Infinity)').throw(); | |
| 501 should(() => source.stop(NaN), 'source.stop(NaN)').throw(); | |
| 502 should(() => source.stop(), 'source.stop()').notThrow(); | |
| 503 | 510 |
| 504 // Verify that start(0, 0) doesn't signal. | 511 // Verify that start(0, -0.0) doesn't signal. |
| 505 should( | 512 let source3; |
| 506 () => source = context.createBufferSource(), | 513 should( |
| 507 'source = context.createBufferSource()') | 514 () => source3 = context.createBufferSource(), |
| 508 .notThrow(); | 515 'source3 = context.createBufferSource()') |
| 509 should(() => source.buffer = buffer, 'source.buffer = buffer').notThrow(); | 516 .notThrow(); |
| 510 should(() => source.start(0, 0), 'source.start(0, 0)').notThrow(); | 517 should(() => source3.buffer = buffer, 'source3.buffer = buffer').notThrow(
); |
| 518 should( |
| 519 () => source3.start(0, -1 / Infinity), 'source3.start(0, -1/Infinity)'
) |
| 520 .notThrow(); |
| 511 | 521 |
| 512 // Verify that start(0, -0.0) doesn't signal. | 522 // It's not clear from the spec, but I think it's valid to call start(). |
| 513 should( | 523 // The spec is silent on what happens if we call stop() afterwards, so |
| 514 () => source = context.createBufferSource(), | 524 // don't call it. |
| 515 'source = context.createBufferSource()') | 525 let source4; |
| 516 .notThrow(); | 526 should( |
| 517 should(() => source.buffer = buffer, 'source.buffer = buffer').notThrow(); | 527 () => source4 = context.createBufferSource(), |
| 518 should(() => source.start(0, -1 / Infinity), 'source.start(0, -1/Infinity)') | 528 'source4 = context.createBufferSource()') |
| 519 .notThrow(); | 529 .notThrow(); |
| 530 should(() => source4.start(), 'source4.start()').notThrow(); |
| 520 | 531 |
| 521 // It's not clear from the spec, but I think it's valid to call start(). The | 532 buffer = context.createBuffer(1, 1, context.sampleRate); |
| 522 // spec is silent on | 533 let source5; |
| 523 // what happens if we call stop() afterwards, so don't call it. | 534 should( |
| 524 should( | 535 () => source5 = context.createBufferSource(), |
| 525 () => source = context.createBufferSource(), | 536 'source5 = context.createBufferSource()') |
| 526 'source = context.createBufferSource()') | 537 .notThrow(); |
| 527 .notThrow(); | 538 should(() => source5.buffer = buffer, 'source5.buffer = buffer').notThrow(
); |
| 528 should(() => source.start(), 'source.start()').notThrow(); | 539 should(() => source5.stop(), 'source5.stop()').throw(); |
| 529 | 540 |
| 530 buffer = context.createBuffer(1, 1, context.sampleRate); | 541 buffer = context.createBuffer(1, 1, context.sampleRate); |
| 531 should( | 542 let source6; |
| 532 () => source = context.createBufferSource(), | 543 should( |
| 533 'source = context.createBufferSource()') | 544 () => source6 = context.createBufferSource(), |
| 534 .notThrow(); | 545 'source6 = context.createBufferSource()') |
| 535 should(() => source.buffer = buffer, 'source.buffer = buffer').notThrow(); | 546 .notThrow(); |
| 536 should(() => source.stop(), 'source.stop()').throw(); | 547 should(() => source6.buffer = buffer, 'source6.buffer = buffer').notThrow(
); |
| 548 should(() => source6.start(), 'source6.start()').notThrow(); |
| 549 should(() => source6.start(), 'source6.start()').throw(); |
| 537 | 550 |
| 538 buffer = context.createBuffer(1, 1, context.sampleRate); | 551 buffer = context.createBuffer(1, 1, context.sampleRate); |
| 539 should( | 552 let source7; |
| 540 () => source = context.createBufferSource(), | 553 should( |
| 541 'source = context.createBufferSource()') | 554 () => source7 = context.createBufferSource(), |
| 542 .notThrow(); | 555 'source7 = context.createBufferSource()') |
| 543 should(() => source.buffer = buffer, 'source.buffer = buffer').notThrow(); | 556 .notThrow(); |
| 544 should(() => source.start(), 'source.start()').notThrow(); | 557 should(() => source7.buffer = buffer, 'source7.buffer = buffer').notThrow(
); |
| 545 should(() => source.start(), 'source.start()').throw(); | 558 should(() => source7.start(), 'source7.start()').notThrow(); |
| 559 should(() => source7.stop(), 'source7.stop()').notThrow(); |
| 546 | 560 |
| 547 buffer = context.createBuffer(1, 1, context.sampleRate); | 561 task.done(); |
| 548 should( | 562 }); |
| 549 () => source = context.createBufferSource(), | |
| 550 'source = context.createBufferSource()') | |
| 551 .notThrow(); | |
| 552 should(() => source.buffer = buffer, 'source.buffer = buffer').notThrow(); | |
| 553 should(() => source.start(), 'source.start()').notThrow(); | |
| 554 should(() => source.stop(), 'source.stop()').notThrow(); | |
| 555 | 563 |
| 556 task.done(); | 564 audit.define( |
| 557 }); | 565 {label: 'oscillator', description: 'start/stop'}, (task, should) => { |
| 558 | 566 |
| 559 audit.define('oscillator', (task, should) => { | 567 let source8; |
| 560 task.describe('Oscillator start/stop'); | 568 // Start/stop for OscillatorNodes |
| 569 should( |
| 570 () => source8 = context.createOscillator(), |
| 571 'source8 = context.createOscillator()') |
| 572 .notThrow(); |
| 573 should( |
| 574 () => source8.start(-Number.MIN_VALUE), |
| 575 'source8.start(-Number.MIN_VALUE)') |
| 576 .throw(); |
| 577 should(() => source8.start(Infinity), 'source8.start(Infinity)').throw(); |
| 578 should(() => source8.start(-Infinity), 'source8.start(-Infinity)').throw()
; |
| 579 should(() => source8.start(NaN), 'source8.start(NaN)').throw(); |
| 580 should(() => source8.start(), 'source8.start()').notThrow(); |
| 581 should( |
| 582 () => source8.stop(-Number.MIN_VALUE), |
| 583 'source8.stop(-Number.MIN_VALUE)') |
| 584 .throw(); |
| 585 should(() => source8.stop(Infinity), 'source8.stop(Infinity)').throw(); |
| 586 should(() => source8.stop(-Infinity), 'source8.stop(-Infinity)').throw(); |
| 587 should(() => source8.stop(NaN), 'source8.stop(NaN)').throw(); |
| 588 should(() => source8.stop(), 'source8.stop()').notThrow(); |
| 561 | 589 |
| 562 // Start/stop for OscillatorNodes | 590 should( |
| 563 should( | 591 () => osc = context.createOscillator(), |
| 564 () => source = context.createOscillator(), | 592 'osc = context.createOscillator()') |
| 565 'source = context.createOscillator()') | 593 .notThrow(); |
| 566 .notThrow(); | 594 should(() => osc.stop(), 'osc.stop()').throw(); |
| 567 should( | 595 should( |
| 568 () => source.start(-Number.MIN_VALUE), 'source.start(-Number.MIN_VALUE)') | 596 () => osc1 = context.createOscillator(), |
| 569 .throw(); | 597 'osc1 = context.createOscillator()') |
| 570 should(() => source.start(Infinity), 'source.start(Infinity)').throw(); | 598 .notThrow(); |
| 571 should(() => source.start(-Infinity), 'source.start(-Infinity)').throw(); | 599 should(() => osc1.start(), 'osc1.start()').notThrow(); |
| 572 should(() => source.start(NaN), 'source.start(NaN)').throw(); | 600 should(() => osc1.stop(), 'osc1.stop()').notThrow(); |
| 573 should(() => source.start(), 'source.start()').notThrow(); | |
| 574 should(() => source.stop(-Number.MIN_VALUE), 'source.stop(-Number.MIN_VALUE)') | |
| 575 .throw(); | |
| 576 should(() => source.stop(Infinity), 'source.stop(Infinity)').throw(); | |
| 577 should(() => source.stop(-Infinity), 'source.stop(-Infinity)').throw(); | |
| 578 should(() => source.stop(NaN), 'source.stop(NaN)').throw(); | |
| 579 should(() => source.stop(), 'source.stop()').notThrow(); | |
| 580 | 601 |
| 581 should( | 602 should(() => osc.setPeriodicWave(null), 'osc.setPeriodicWave(null)') |
| 582 () => osc = context.createOscillator(), | 603 .throw(); |
| 583 'osc = context.createOscillator()') | |
| 584 .notThrow(); | |
| 585 should(() => osc.stop(), 'osc.stop()').throw(); | |
| 586 should( | |
| 587 () => osc1 = context.createOscillator(), | |
| 588 'osc1 = context.createOscillator()') | |
| 589 .notThrow(); | |
| 590 should(() => osc1.start(), 'osc1.start()').notThrow(); | |
| 591 should(() => osc1.stop(), 'osc1.stop()').notThrow(); | |
| 592 | |
| 593 should(() => osc.setPeriodicWave(null), 'osc.setPeriodicWave(null)').throw(); | |
| 594 | 604 |
| 595 | 605 |
| 596 task.done(); | 606 task.done(); |
| 597 }); | 607 }); |
| 598 | 608 |
| 599 audit.define('convolver', (task, should) => { | 609 audit.define('convolver', (task, should) => { |
| 600 task.describe('Convolver'); | |
| 601 | |
| 602 // Convolver buffer rate must match context rate. Create on offline context so | 610 // Convolver buffer rate must match context rate. Create on offline context so |
| 603 // we | 611 // we |
| 604 // specify the context rate exactly, in case the test is run on platforms with | 612 // specify the context rate exactly, in case the test is run on platforms with |
| 605 // different | 613 // different |
| 606 // HW sample rates. | 614 // HW sample rates. |
| 607 should( | 615 should( |
| 608 () => oc = new OfflineAudioContext(1, 44100, 44100), | 616 () => oc = new OfflineAudioContext(1, 44100, 44100), |
| 609 'oc = new OfflineAudioContext(1, 44100, 44100)') | 617 'oc = new OfflineAudioContext(1, 44100, 44100)') |
| 610 .notThrow(); | 618 .notThrow(); |
| 611 should(() => conv = oc.createConvolver(), 'conv = oc.createConvolver()') | 619 should(() => conv = oc.createConvolver(), 'conv = oc.createConvolver()') |
| 612 .notThrow(); | 620 .notThrow(); |
| 613 should(() => conv.buffer = {}, 'conv.buffer = {}').throw(); | 621 should(() => conv.buffer = {}, 'conv.buffer = {}').throw(); |
| 614 should( | 622 should( |
| 615 () => conv.buffer = oc.createBuffer(1, 100, 22050), | 623 () => conv.buffer = oc.createBuffer(1, 100, 22050), |
| 616 'conv.buffer = oc.createBuffer(1, 100, 22050)') | 624 'conv.buffer = oc.createBuffer(1, 100, 22050)') |
| 617 .throw(); | 625 .throw(); |
| 618 // conv.buffer should be unchanged (null) because the above failed. | 626 // conv.buffer should be unchanged (null) because the above failed. |
| 619 should(conv.buffer, 'conv.buffer').beEqualTo(null); | 627 should(conv.buffer, 'conv.buffer').beEqualTo(null); |
| 620 | 628 |
| 621 task.done(); | 629 task.done(); |
| 622 }); | 630 }); |
| 623 | 631 |
| 624 audit.define('panner', (task, should) => { | 632 audit.define('panner', (task, should) => { |
| 625 task.describe('Panner'); | |
| 626 | |
| 627 // PannerNode channel count and mode | 633 // PannerNode channel count and mode |
| 628 panner = context.createPanner(); | 634 panner = context.createPanner(); |
| 629 // Channel count can only be set to 1 or 2. | 635 // Channel count can only be set to 1 or 2. |
| 630 should(() => panner.channelCount = 1, 'panner.channelCount = 1').notThrow(); | 636 should(() => panner.channelCount = 1, 'panner.channelCount = 1').notThrow(); |
| 631 should(() => panner.channelCount = 2, 'panner.channelCount = 2').notThrow(); | 637 should(() => panner.channelCount = 2, 'panner.channelCount = 2').notThrow(); |
| 632 shouldThrowAndBeUnchanged(should, panner, 'channelCount', 0); | 638 shouldThrowAndBeUnchanged(should, panner, 'channelCount', 0); |
| 633 shouldThrowAndBeUnchanged(should, panner, 'channelCount', 3); | 639 shouldThrowAndBeUnchanged(should, panner, 'channelCount', 3); |
| 634 // It is illegal to set the mode to 'max' | 640 // It is illegal to set the mode to 'max' |
| 635 shouldThrowAndBeUnchanged(should, panner, 'channelCountMode', 'max'); | 641 shouldThrowAndBeUnchanged(should, panner, 'channelCountMode', 'max'); |
| 636 should( | 642 should( |
| 637 () => panner.channelCountMode = 'explicit', | 643 () => panner.channelCountMode = 'explicit', |
| 638 'panner.channelCountMode = "explicit"') | 644 'panner.channelCountMode = "explicit"') |
| 639 .notThrow(); | 645 .notThrow(); |
| 640 should( | 646 should( |
| 641 () => panner.channelCountMode = 'clamped-max', | 647 () => panner.channelCountMode = 'clamped-max', |
| 642 'panner.channelCountMode = "clamped-max"') | 648 'panner.channelCountMode = "clamped-max"') |
| 643 .notThrow(); | 649 .notThrow(); |
| 644 should( | 650 should( |
| 645 () => panner.channelCountMode = 'junk', | 651 () => panner.channelCountMode = 'junk', |
| 646 'panner.channelCountMode = "junk"') | 652 'panner.channelCountMode = "junk"') |
| 647 .notThrow(); | 653 .notThrow(); |
| 648 | 654 |
| 649 task.done(); | 655 task.done(); |
| 650 }); | 656 }); |
| 651 | 657 |
| 652 audit.define('script-processor', (task, should) => { | 658 audit.define('script-processor', (task, should) => { |
| 653 task.describe('ScriptProcessor'); | |
| 654 | |
| 655 // Test channel count and mode for a ScriptProcessor. | 659 // Test channel count and mode for a ScriptProcessor. |
| 656 should( | 660 should( |
| 657 () => script = context.createScriptProcessor(256, 3), | 661 () => script = context.createScriptProcessor(256, 3), |
| 658 'script = context.createScriptProcessor(256, 3)') | 662 'script = context.createScriptProcessor(256, 3)') |
| 659 .notThrow(); | 663 .notThrow(); |
| 660 // Make sure the channelCount and mode are set correctly. | 664 // Make sure the channelCount and mode are set correctly. |
| 661 should(script.channelCount, 'script.channelCount').beEqualTo(3); | 665 should(script.channelCount, 'script.channelCount').beEqualTo(3); |
| 662 should(script.channelCountMode, 'script.channelCountMode') | 666 should(script.channelCountMode, 'script.channelCountMode') |
| 663 .beEqualTo('explicit'); | 667 .beEqualTo('explicit'); |
| 664 // Cannot change the channelCount or mode to anything else | 668 // Cannot change the channelCount or mode to anything else |
| 665 should(() => script.channelCount = 3, 'script.channelCount = 3').notThrow(); | 669 should(() => script.channelCount = 3, 'script.channelCount = 3').notThrow(); |
| 666 shouldThrowAndBeUnchanged(should, script, 'channelCount', 1); | 670 shouldThrowAndBeUnchanged(should, script, 'channelCount', 1); |
| 667 | 671 |
| 668 shouldThrowAndBeUnchanged(should, script, 'channelCount', 7); | 672 shouldThrowAndBeUnchanged(should, script, 'channelCount', 7); |
| 669 should( | 673 should( |
| 670 () => script.channelCountMode = 'explicit', | 674 () => script.channelCountMode = 'explicit', |
| 671 'script.channelCountMode = "explicit"') | 675 'script.channelCountMode = "explicit"') |
| 672 .notThrow(); | 676 .notThrow(); |
| 673 shouldThrowAndBeUnchanged(should, script, 'channelCountMode', 'max'); | 677 shouldThrowAndBeUnchanged(should, script, 'channelCountMode', 'max'); |
| 674 shouldThrowAndBeUnchanged(should, script, 'channelCountMode', 'clamped-max'); | 678 shouldThrowAndBeUnchanged(should, script, 'channelCountMode', 'clamped-max'); |
| 675 should( | 679 should( |
| 676 () => script.channelCountMode = 'junk', | 680 () => script.channelCountMode = 'junk', |
| 677 'script.channelCountMode = "junk"') | 681 'script.channelCountMode = "junk"') |
| 678 .notThrow(); | 682 .notThrow(); |
| 679 | 683 |
| 680 task.done(); | 684 task.done(); |
| 681 }); | 685 }); |
| 682 | 686 |
| 683 audit.define('misc', (task, should) => { | 687 audit.define( |
| 684 task.describe('Miscellaneous'); | 688 {label: 'misc', description: 'Miscellaneous tests'}, (task, should) => { |
| 685 | 689 |
| 686 // noteOn and noteOff don't exist anymore | 690 // noteOn and noteOff don't exist anymore |
| 687 should(osc.noteOn, 'osc.noteOn').beEqualTo(undefined); | 691 should(osc.noteOn, 'osc.noteOn').beEqualTo(undefined); |
| 688 should(osc.noteOff, 'osc.noteOff').beEqualTo(undefined); | 692 should(osc.noteOff, 'osc.noteOff').beEqualTo(undefined); |
| 689 should(source.noteOn, 'source.noteOn').beEqualTo(undefined); | 693 should(source.noteOn, 'source.noteOn').beEqualTo(undefined); |
| 690 should(source.noteOff, 'source.noteOff').beEqualTo(undefined); | 694 should(source.noteOff, 'source.noteOff').beEqualTo(undefined); |
| 691 | 695 |
| 692 task.done(); | 696 task.done(); |
| 693 }); | 697 }); |
| 694 | 698 |
| 695 audit.run(); | 699 audit.run(); |
| 696 </script> | 700 </script> |
| 697 </body> | 701 </body> |
| 698 </html> | 702 </html> |
| OLD | NEW |