Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/Analyser/realtimeanalyser-downmix.html

Issue 2595633002: Convert Analyser tests to use testharness (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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; 16 window.jsTestIsAsync = true;
hongchan 2016/12/20 23:04:30 ditto.
17 17
18 var sampleRate = 44100; 18 var sampleRate = 44100;
19 var renderFrames = 2048; 19 var renderFrames = 2048;
20 20
21 var audit = Audit.createTaskRunner(); 21 var audit = Audit.createTaskRunner();
22 22
23 var testConfigs = [{ 23 var testConfigs = [{
24 channelCount: 1, 24 channelCount: 1,
25 message: "mono", 25 message: "mono",
26 floatRelError: 6.3283e-8 26 floatRelError: 6.3283e-8
(...skipping 18 matching lines...) Expand all
45 // Create tasks for each entry in testConfigs 45 // Create tasks for each entry in testConfigs
46 for (k in testConfigs) { 46 for (k in testConfigs) {
47 audit.defineTask(testConfigs[k].message, (function (config) { 47 audit.defineTask(testConfigs[k].message, (function (config) {
48 return function(done) { 48 return function(done) {
49 runTest(config).then(done); 49 runTest(config).then(done);
50 }; 50 };
51 })(testConfigs[k])); 51 })(testConfigs[k]));
52 } 52 }
53 53
54 audit.defineTask("finish", function (done) { 54 audit.defineTask("finish", function (done) {
55 finishJSTest();
56 done(); 55 done();
57 }); 56 });
58 57
59 audit.runTasks(); 58 audit.runTasks();
60 59
61 // Test downmixing of the AnalyserNode time data. We use the downmixing t hat automatically 60 // 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 61 // happens in the destination node to generate the reference data which is compared to the
63 // data that the Analyser node has captured. 62 // data that the Analyser node has captured.
64 function runTest(options) { 63 function runTest(options) {
65 // Context MUST have exactly one channel so that we downmix the source t o mono to generate 64 // 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
108 107
109 var expectedTimeData = renderedBuffer.getChannelData(0).subarray(0, an alyser.fftSize); 108 var expectedTimeData = renderedBuffer.getChannelData(0).subarray(0, an alyser.fftSize);
110 var fftOrder = Math.floor(Math.log2(analyser.fftSize)); 109 var fftOrder = Math.floor(Math.log2(analyser.fftSize));
111 var expectedFreqData = computeFFTMagnitude(expectedTimeData, fftOrder) .map(linearToDb); 110 var expectedFreqData = computeFFTMagnitude(expectedTimeData, fftOrder) .map(linearToDb);
112 111
113 success = compareFloatFreq(prefix + " freq data", freqData, expectedFr eqData, { 112 success = compareFloatFreq(prefix + " freq data", freqData, expectedFr eqData, {
114 precision: 6, 113 precision: 6,
115 floatRelError: options.floatRelError, 114 floatRelError: options.floatRelError,
116 }) && success; 115 }) && success;
117 116
118 if (success) 117 Should(prefix, success)
119 testPassed(prefix + " downmixed correctly.\n"); 118 .summarize("downmixed correctly.",
120 else 119 "no downmixed correctly.");
121 testFailed(prefix + " not downmixed correctly.\n");
122 }); 120 });
123 } 121 }
124 </script> 122 </script>
125 </body> 123 </body>
126 </html> 124 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698