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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/resources/stereopanner-testing.js

Issue 2695113003: Convert StereoPanner Audit tests to testharness (Closed)
Patch Set: Fix typo Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/StereoPanner/stereopannernode-panning-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var StereoPannerTest = (function () { 1 var StereoPannerTest = (function () {
2 2
3 // Constants 3 // Constants
4 var PI_OVER_TWO = Math.PI * 0.5; 4 var PI_OVER_TWO = Math.PI * 0.5;
5 5
6 var gSampleRate = 44100; 6 var gSampleRate = 44100;
7 7
8 // Time step when each panner node starts. 8 // Time step when each panner node starts.
9 var gTimeStep = 0.001; 9 var gTimeStep = 0.001;
10 10
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 }); 169 });
170 } 170 }
171 171
172 this.impulseIndex++; 172 this.impulseIndex++;
173 } 173 }
174 } 174 }
175 }; 175 };
176 176
177 177
178 Test.prototype.showResult = function () { 178 Test.prototype.showResult = function () {
179 if (this.impulseIndex === gNodesToCreate) { 179 Should("Number of impulses found", this.impulseIndex)
180 testPassed('Number of impulses matches the number of panner nodes.'); 180 .beEqualTo(gNodesToCreate);
181 } else {
182 testFailed('Number of impulses is incorrect. (Found '
183 + this.impulseIndex
184 + ' but expected '
185 + gNodesToCreate
186 + ')'
187 );
188 this.success = false;
189 }
190 181
191 if (this.errors.length === 0) { 182 Should("Number of impulse at the wrong offset", this.errors.length)
192 testPassed('All impulses at expected offsets.'); 183 .beEqualTo(0);
193 } else {
194 testFailed(this.errors.length + ' timing errors found in '
195 + this.nodesToCreate + ' panner nodes.'
196 );
197 for (var i = 0; i < this.errors.length; i++) {
198 testFailed('Impulse at sample ' + this.errors[i].actual
199 + ' but expected ' + this.errors[i].expected
200 );
201 }
202 this.success = false;
203 }
204 184
205 if (this.maxErrorL <= this.maxAllowedError) { 185 Should("Left channel error magnitude", this.maxErrorL)
206 testPassed('Left channel gain values are correct.'); 186 .beLessThanOrEqualTo(this.maxAllowedError);
207 } else {
208 testFailed('Left channel gain values are incorrect. Max error = '
209 + this.maxErrorL + ' at time ' + this.onsets[this.maxErrorIndexL]
210 + ' (threshold = ' + this.maxAllowedError + ')'
211 );
212 this.success = false;
213 }
214 187
215 if (this.maxErrorR <= this.maxAllowedError) { 188 Should("Right channel error magnitude", this.maxErrorR)
216 testPassed('Right channel gain values are correct.'); 189 .beLessThanOrEqualTo(this.maxAllowedError);
217 } else {
218 testFailed('Right channel gain values are incorrect. Max error = '
219 + this.maxErrorR + ' at time ' + this.onsets[this.maxErrorIndexR]
220 + ' (threshold = ' + this.maxAllowedError + ')'
221 );
222 this.success = false;
223 }
224 }; 190 };
225 191
226 192
227 Test.prototype.finish = function () { 193 Test.prototype.finish = function () {
228 if (this.success) 194 Should(this.description, this.success)
229 testPassed(this.description + ': passed.'); 195 .summarize('passed', 'failed');
230 else
231 testFailed(this.description + ': failed.');
232 }; 196 };
233 197
234 198
235 Test.prototype.run = function (done) { 199 Test.prototype.run = function (done) {
236 200
237 this.init(); 201 this.init();
238 this.prepare(); 202 this.prepare();
239 this.context.oncomplete = function (event) { 203 this.context.oncomplete = function (event) {
240 this.renderedBufferL = event.renderedBuffer.getChannelData(0); 204 this.renderedBufferL = event.renderedBuffer.getChannelData(0);
241 this.renderedBufferR = event.renderedBuffer.getChannelData(1); 205 this.renderedBufferR = event.renderedBuffer.getChannelData(1);
242 this.verify(); 206 this.verify();
243 this.showResult(); 207 this.showResult();
244 this.finish(); 208 this.finish();
245 done(); 209 done();
246 }.bind(this); 210 }.bind(this);
247 this.context.startRendering(); 211 this.context.startRendering();
248 212
249 }; 213 };
250 214
251 215
252 return { 216 return {
253 create: function (options) { 217 create: function (options) {
254 return new Test(options); 218 return new Test(options);
255 } 219 }
256 }; 220 };
257 221
258 })(); 222 })();
259 223
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/StereoPanner/stereopannernode-panning-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698