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