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

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: 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/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;
18
19 // Use a power of two to eliminate any round-off in the computation of the times for 17 // Use a power of two to eliminate any round-off in the computation of the times for
20 // context.suspend(). 18 // context.suspend().
21 var sampleRate = 32768; 19 var sampleRate = 32768;
22 20
23 // The largest FFT size for the analyser node is 32768. We want to render longer than this so 21 // 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. 22 // that we have at least one complete buffer of data of 32768 samples.
25 var renderFrames = 2 * 32768; 23 var renderFrames = 2 * 32768;
26 var renderDuration = renderFrames / sampleRate; 24 var renderDuration = renderFrames / sampleRate;
27 25
28 var audit = Audit.createTaskRunner(); 26 var audit = Audit.createTaskRunner();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // Convert the expected float frequency data to byte data. 108 // Convert the expected float frequency data to byte data.
111 var expectedByteData = convertFloatToByte(smoothedFloatResult.map(line arToDb), 109 var expectedByteData = convertFloatToByte(smoothedFloatResult.map(line arToDb),
112 analyser.minDecibels, analyser.maxDecibels); 110 analyser.minDecibels, analyser.maxDecibels);
113 111
114 success = Should(analyser.fftSize + "-point byte FFT", byteFreqData) 112 success = Should(analyser.fftSize + "-point byte FFT", byteFreqData)
115 .beCloseToArray(expectedByteData, 0) && success; 113 .beCloseToArray(expectedByteData, 0) && success;
116 114
117 }).then(context.resume.bind(context)); 115 }).then(context.resume.bind(context));
118 116
119 context.startRendering().then(function (buffer) { 117 context.startRendering().then(function (buffer) {
120 var prefix = "FFT smoothing performed "; 118 var prefix = "FFT smoothing performed";
121 var suffix = " with smoothing constant " + analyser.smoothingTimeConst ant + ".\n" 119 var suffix = " with smoothing constant " + analyser.smoothingTimeConst ant;
122 120
123 if (success) 121 Should(prefix, success)
124 testPassed(prefix + "correctly" + suffix); 122 .summarize("correctly" + suffix,
125 else 123 "incorrectly" + suffix);
126 testFailed(prefix + "incorrectly" + suffix);
127 }).then(done); 124 }).then(done);
128 }); 125 });
129 126
130 audit.defineTask("finish", function (done) { 127 audit.defineTask("finish", function (done) {
131 finishJSTest();
132 done(); 128 done();
133 }); 129 });
134 130
135 audit.runTasks(); 131 audit.runTasks();
136 132
137 </script> 133 </script>
138 </body> 134 </body>
139 </html> 135 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698