Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> | |
| 5 <script src="../resources/compatibility.js"></script> | 6 <script src="../resources/compatibility.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 <script src="../resources/fft.js"></script> | 9 <script src="../resources/fft.js"></script> |
| 9 <script src="../resources/realtimeanalyser-testing.js"></script> | 10 <script src="../resources/realtimeanalyser-testing.js"></script> |
| 10 <title>Test AnalyserNode Downmixing</title> | 11 <title>Test AnalyserNode Downmixing</title> |
| 11 </head> | 12 </head> |
| 12 | 13 |
| 13 <body> | 14 <body> |
| 14 <script> | 15 <script> |
| 15 description("Test AnalyserNode Downmixing"); | |
| 16 window.jsTestIsAsync = true; | |
| 17 | 16 |
|
hongchan
2016/12/21 16:22:10
Let's remove this empty line. I guess all the inst
| |
| 18 var sampleRate = 44100; | 17 var sampleRate = 44100; |
| 19 var renderFrames = 2048; | 18 var renderFrames = 2048; |
| 20 | 19 |
| 21 var audit = Audit.createTaskRunner(); | 20 var audit = Audit.createTaskRunner(); |
| 22 | 21 |
| 23 var testConfigs = [{ | 22 var testConfigs = [{ |
| 24 channelCount: 1, | 23 channelCount: 1, |
| 25 message: "mono", | 24 message: "mono", |
| 26 floatRelError: 6.3283e-8 | 25 floatRelError: 6.3283e-8 |
| 27 }, { | 26 }, { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 45 // Create tasks for each entry in testConfigs | 44 // Create tasks for each entry in testConfigs |
| 46 for (k in testConfigs) { | 45 for (k in testConfigs) { |
| 47 audit.defineTask(testConfigs[k].message, (function (config) { | 46 audit.defineTask(testConfigs[k].message, (function (config) { |
| 48 return function(done) { | 47 return function(done) { |
| 49 runTest(config).then(done); | 48 runTest(config).then(done); |
| 50 }; | 49 }; |
| 51 })(testConfigs[k])); | 50 })(testConfigs[k])); |
| 52 } | 51 } |
| 53 | 52 |
| 54 audit.defineTask("finish", function (done) { | 53 audit.defineTask("finish", function (done) { |
| 55 finishJSTest(); | |
| 56 done(); | 54 done(); |
| 57 }); | 55 }); |
| 58 | 56 |
| 59 audit.runTasks(); | 57 audit.runTasks(); |
| 60 | 58 |
| 61 // Test downmixing of the AnalyserNode time data. We use the downmixing t hat automatically | 59 // Test downmixing of the AnalyserNode time data. We use the downmixing t hat automatically |
| 62 // happens in the destination node to generate the reference data which is compared to the | 60 // happens in the destination node to generate the reference data which is compared to the |
| 63 // data that the Analyser node has captured. | 61 // data that the Analyser node has captured. |
| 64 function runTest(options) { | 62 function runTest(options) { |
| 65 // Context MUST have exactly one channel so that we downmix the source t o mono to generate | 63 // Context MUST have exactly one channel so that we downmix the source t o mono to generate |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 | 106 |
| 109 var expectedTimeData = renderedBuffer.getChannelData(0).subarray(0, an alyser.fftSize); | 107 var expectedTimeData = renderedBuffer.getChannelData(0).subarray(0, an alyser.fftSize); |
| 110 var fftOrder = Math.floor(Math.log2(analyser.fftSize)); | 108 var fftOrder = Math.floor(Math.log2(analyser.fftSize)); |
| 111 var expectedFreqData = computeFFTMagnitude(expectedTimeData, fftOrder) .map(linearToDb); | 109 var expectedFreqData = computeFFTMagnitude(expectedTimeData, fftOrder) .map(linearToDb); |
| 112 | 110 |
| 113 success = compareFloatFreq(prefix + " freq data", freqData, expectedFr eqData, { | 111 success = compareFloatFreq(prefix + " freq data", freqData, expectedFr eqData, { |
| 114 precision: 6, | 112 precision: 6, |
| 115 floatRelError: options.floatRelError, | 113 floatRelError: options.floatRelError, |
| 116 }) && success; | 114 }) && success; |
| 117 | 115 |
| 118 if (success) | 116 Should(prefix, success) |
| 119 testPassed(prefix + " downmixed correctly.\n"); | 117 .summarize("downmixed correctly.", |
| 120 else | 118 "no downmixed correctly."); |
| 121 testFailed(prefix + " not downmixed correctly.\n"); | |
| 122 }); | 119 }); |
| 123 } | 120 } |
| 124 </script> | 121 </script> |
| 125 </body> | 122 </body> |
| 126 </html> | 123 </html> |
| OLD | NEW |