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

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

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

Powered by Google App Engine
This is Rietveld 408576698