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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/Analyser/realtimeanalyser-freq-data-smoothing.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/realtimeanalyser-testing.js"></script> 9 <script src="../resources/realtimeanalyser-testing.js"></script>
9 <script src="../resources/fft.js"></script> 10 <script src="../resources/fft.js"></script>
10 <title>Test Analyser getFloatFrequencyData and getByteFrequencyData, Smoothi ng</title> 11 <title>Test Analyser getFloatFrequencyData and getByteFrequencyData, Smoothi ng</title>
11 12
12 </head> 13 </head>
13 14
14 <body> 15 <body>
15 <script> 16 <script>
16 description("Test AnalyserNode getFloatFrequencyData and getByteFrequencyD ata, Smoothing");
17 window.jsTestIsAsync = true; 17 window.jsTestIsAsync = true;
hongchan 2016/12/20 23:04:31 ditto.
18 18
19 // Use a power of two to eliminate any round-off in the computation of the times for 19 // Use a power of two to eliminate any round-off in the computation of the times for
20 // context.suspend(). 20 // context.suspend().
21 var sampleRate = 32768; 21 var sampleRate = 32768;
22 22
23 // The largest FFT size for the analyser node is 32768. We want to render longer than this so 23 // The largest FFT size for the analyser node is 32768. We want to render longer than this so
24 // that we have at least one complete buffer of data of 32768 samples. 24 // that we have at least one complete buffer of data of 32768 samples.
25 var renderFrames = 2 * 32768; 25 var renderFrames = 2 * 32768;
26 var renderDuration = renderFrames / sampleRate; 26 var renderDuration = renderFrames / sampleRate;
27 27
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // Convert the expected float frequency data to byte data. 110 // Convert the expected float frequency data to byte data.
111 var expectedByteData = convertFloatToByte(smoothedFloatResult.map(line arToDb), 111 var expectedByteData = convertFloatToByte(smoothedFloatResult.map(line arToDb),
112 analyser.minDecibels, analyser.maxDecibels); 112 analyser.minDecibels, analyser.maxDecibels);
113 113
114 success = Should(analyser.fftSize + "-point byte FFT", byteFreqData) 114 success = Should(analyser.fftSize + "-point byte FFT", byteFreqData)
115 .beCloseToArray(expectedByteData, 0) && success; 115 .beCloseToArray(expectedByteData, 0) && success;
116 116
117 }).then(context.resume.bind(context)); 117 }).then(context.resume.bind(context));
118 118
119 context.startRendering().then(function (buffer) { 119 context.startRendering().then(function (buffer) {
120 var prefix = "FFT smoothing performed "; 120 var prefix = "FFT smoothing performed";
121 var suffix = " with smoothing constant " + analyser.smoothingTimeConst ant + ".\n" 121 var suffix = " with smoothing constant " + analyser.smoothingTimeConst ant;
122 122
123 if (success) 123 Should(prefix, success)
124 testPassed(prefix + "correctly" + suffix); 124 .summarize("correctly" + suffix,
125 else 125 "incorrectly" + suffix);
126 testFailed(prefix + "incorrectly" + suffix);
127 }).then(done); 126 }).then(done);
128 }); 127 });
129 128
130 audit.defineTask("finish", function (done) { 129 audit.defineTask("finish", function (done) {
131 finishJSTest();
132 done(); 130 done();
133 }); 131 });
134 132
135 audit.runTasks(); 133 audit.runTasks();
136 134
137 </script> 135 </script>
138 </body> 136 </body>
139 </html> 137 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698