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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/Oscillator/start-sampling.html

Issue 2768983002: Fix duplicate test names in WebAudio tests (Closed)
Patch Set: Created 3 years, 9 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 <title>Test Sampling of Oscillator Start Times</title> 4 <title>Test Sampling of Oscillator Start Times</title>
5 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script> 6 <script src="../../resources/testharnessreport.js"></script>
7 <script src="../resources/audit-util.js"></script> 7 <script src="../resources/audit-util.js"></script>
8 <script src="../resources/audit.js"></script> 8 <script src="../resources/audit.js"></script>
9 </head> 9 </head>
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // 97 //
98 // sin(2*pi*f*(t-t0)) 98 // sin(2*pi*f*(t-t0))
99 // 99 //
100 // where f is the oscillator frequency and t0 is the start time. 100 // where f is the oscillator frequency and t0 is the start time.
101 let actualStart = Math.ceil(startFrame); 101 let actualStart = Math.ceil(startFrame);
102 let omega = 2 * Math.PI * osc.frequency.value / context.sampleRate; 102 let omega = 2 * Math.PI * osc.frequency.value / context.sampleRate;
103 for (let k = actualStart; k < actual.length; ++k) { 103 for (let k = actualStart; k < actual.length; ++k) {
104 expected[k] = Math.sin(omega * (k - startFrame)); 104 expected[k] = Math.sin(omega * (k - startFrame));
105 } 105 }
106 106
107 should(actual, "Oscillator.start(" + startFrame + " frames)") 107 let prefix = "Oscillator.start(" + startFrame + " frames)";
108 should(actual, prefix)
108 .beCloseToArray(expected, { 109 .beCloseToArray(expected, {
109 absoluteThreshold: thresholds.error 110 absoluteThreshold: thresholds.error
110 }); 111 });
111 let snr = 10 * Math.log10(computeSNR(actual, expected)); 112 let snr = 10 * Math.log10(computeSNR(actual, expected));
112 should(snr, "SNR (dB)") 113 should(snr, prefix + ": SNR (dB)")
113 .beGreaterThanOrEqualTo(thresholds.snrThreshold); 114 .beGreaterThanOrEqualTo(thresholds.snrThreshold);
114 }) 115 })
115 } 116 }
116 117
117 function testStartWithGain(should, sampleRate, thresholds) { 118 function testStartWithGain(should, sampleRate, thresholds) {
118 // Test consists of starting a cosine wave with a quarter wavelength 119 // Test consists of starting a cosine wave with a quarter wavelength
119 // delay and comparing that with a sine wave that has the initial 120 // delay and comparing that with a sine wave that has the initial
120 // quarter wavelength zeroed out. These should be equal. 121 // quarter wavelength zeroed out. These should be equal.
121 122
122 let context = new OfflineAudioContext(3, renderFrames, sampleRate); 123 let context = new OfflineAudioContext(3, renderFrames, sampleRate);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // Channel 1 = osc with start 163 // Channel 1 = osc with start
163 // Channel 2 = osc with gain 164 // Channel 2 = osc with gain
164 165
165 // Channel 0 should be very close to 0. 166 // Channel 0 should be very close to 0.
166 // Channel 1 should match channel 2 very closely. 167 // Channel 1 should match channel 2 very closely.
167 let diff = result.getChannelData(0); 168 let diff = result.getChannelData(0);
168 let oscStart = result.getChannelData(1); 169 let oscStart = result.getChannelData(1);
169 let oscGain = result.getChannelData(2); 170 let oscGain = result.getChannelData(2);
170 let snr = 10 * Math.log10(computeSNR(oscStart, oscGain)); 171 let snr = 10 * Math.log10(computeSNR(oscStart, oscGain));
171 172
172 should(oscStart, "Delayed cosine oscillator at sample rate " + sampleR ate) 173 let prefix = "Sample rate " + sampleRate + ": Delayed cosine oscillato r";
hongchan 2017/03/22 22:09:41 Wrap at 80.
174 should(oscStart, prefix)
173 .beCloseToArray(oscGain, { 175 .beCloseToArray(oscGain, {
174 absoluteThreshold: thresholds.error 176 absoluteThreshold: thresholds.error
175 }); 177 });
176 should(snr, "SNR (dB)") 178 should(snr, prefix + ": SNR (dB)")
177 .beGreaterThanOrEqualTo(thresholds.snrThreshold); 179 .beGreaterThanOrEqualTo(thresholds.snrThreshold);
178 }); 180 });
179 } 181 }
180 182
181 audit.run(); 183 audit.run();
182 </script> 184 </script>
183 </body> 185 </body>
184 </html> 186 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698