| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 | 3 |
| 4 <head> | 4 <head> |
| 5 <script src="../../resources/js-test.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script src="../resources/audit-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
| 7 <script src="../resources/audio-testing.js"></script> | 8 <script src="../resources/audio-testing.js"></script> |
| 8 </head> | 9 </head> |
| 9 | 10 |
| 10 <body> | 11 <body> |
| 11 <script> | 12 <script> |
| 12 description('Test method chaining feature of AudioNode.connect() method.'); | |
| 13 window.jsTestIsAsync = true; | |
| 14 | 13 |
| 15 // AudioNode dictionary with associated arguments. | 14 // AudioNode dictionary with associated arguments. |
| 16 var nodeDictionary = [ | 15 var nodeDictionary = [ |
| 17 { name: 'Analyser' }, | 16 { name: 'Analyser' }, |
| 18 { name: 'BiquadFilter' }, | 17 { name: 'BiquadFilter' }, |
| 19 { name: 'BufferSource' }, | 18 { name: 'BufferSource' }, |
| 20 { name: 'ChannelMerger', args: [6] }, | 19 { name: 'ChannelMerger', args: [6] }, |
| 21 { name: 'ChannelSplitter', args: [6] }, | 20 { name: 'ChannelSplitter', args: [6] }, |
| 22 { name: 'Convolver' }, | 21 { name: 'Convolver' }, |
| 23 { name: 'Delay', args: [] }, | 22 { name: 'Delay', args: [] }, |
| 24 { name: 'DynamicsCompressor' }, | 23 { name: 'DynamicsCompressor' }, |
| 25 { name: 'Gain' }, | 24 { name: 'Gain' }, |
| 26 { name: 'Oscillator' }, | 25 { name: 'Oscillator' }, |
| 27 { name: 'Panner' }, | 26 { name: 'Panner' }, |
| 28 { name: 'ScriptProcessor', args: [512, 1, 1] }, | 27 { name: 'ScriptProcessor', args: [512, 1, 1] }, |
| 29 { name: 'StereoPanner' }, | 28 { name: 'StereoPanner' }, |
| 30 { name: 'WaveShaper' } | 29 { name: 'WaveShaper' } |
| 31 ]; | 30 ]; |
| 32 | 31 |
| 33 | 32 |
| 34 function verifyReturnedNode(config) { | 33 function verifyReturnedNode(config) { |
| 35 if (config.destination === config.returned) { | 34 Should('The return value of ' + config.desc + |
| 36 testPassed('The return value of ' + config.desc + ' matches the destinat
ion ' + | 35 ' matches the destination ' + |
| 37 config.returned.constructor.name + '.'); | 36 config.returned.constructor.name, |
| 38 } else { | 37 config.destination === config.returned |
| 39 testFailed('The return value of ' + config.desc + ' does NOT match the d
estination ' + | 38 ) |
| 40 config.destination.constructor.name + '.'); | 39 .beEqualTo(true); |
| 41 } | |
| 42 } | 40 } |
| 43 | 41 |
| 44 // Test utility for batch method checking: in order to test 3 method | 42 // Test utility for batch method checking: in order to test 3 method |
| 45 // signatures, so we create 3 dummy destinations. | 43 // signatures, so we create 3 dummy destinations. |
| 46 // 1) .connect(GainNode) | 44 // 1) .connect(GainNode) |
| 47 // 2) .connect(BiquadFilterNode, output) | 45 // 2) .connect(BiquadFilterNode, output) |
| 48 // 3) .connect(ChannelMergerNode, output, input) | 46 // 3) .connect(ChannelMergerNode, output, input) |
| 49 function testConnectMethod(context, options) { | 47 function testConnectMethod(context, options) { |
| 50 var source = context['create' + options.name].apply(context, options.args)
; | 48 var source = context['create' + options.name].apply(context, options.args)
; |
| 51 var sourceName = source.constructor.name; | 49 var sourceName = source.constructor.name; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 source.connect(gain1).connect(gain2).connect(context.destination); | 147 source.connect(gain1).connect(gain2).connect(context.destination); |
| 150 source.start(); | 148 source.start(); |
| 151 | 149 |
| 152 context.startRendering().then(function (buffer) { | 150 context.startRendering().then(function (buffer) { |
| 153 Should('The output of chained connection of gain nodes', buffer.getChann
elData(0)) | 151 Should('The output of chained connection of gain nodes', buffer.getChann
elData(0)) |
| 154 .beConstantValueOf(0.125); | 152 .beConstantValueOf(0.125); |
| 155 }).then(done); | 153 }).then(done); |
| 156 }); | 154 }); |
| 157 | 155 |
| 158 audit.defineTask('finish', function (done) { | 156 audit.defineTask('finish', function (done) { |
| 159 finishJSTest(); | |
| 160 done(); | 157 done(); |
| 161 }); | 158 }); |
| 162 | 159 |
| 163 audit.runTasks( | 160 audit.runTasks( |
| 164 'from-dictionary', | 161 'from-dictionary', |
| 165 'media-group', | 162 'media-group', |
| 166 'invalid-operation', | 163 'invalid-operation', |
| 167 'verification', | 164 'verification', |
| 168 'finish' | 165 'finish' |
| 169 ); | 166 ); |
| 170 | 167 |
| 171 successfullyParsed = true; | 168 successfullyParsed = true; |
| 172 </script> | 169 </script> |
| 173 </body> | 170 </body> |
| 174 | 171 |
| 175 </html> | 172 </html> |
| OLD | NEW |