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

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

Issue 2788793004: Convert StereoPanner tests to use new Audit (Closed)
Patch Set: Created 3 years, 8 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.html ('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 30 matching lines...) Expand all
41 }; 41 };
42 } 42 }
43 43
44 44
45 /** 45 /**
46 * Test implementation class. 46 * Test implementation class.
47 * @param {Object} options Test options 47 * @param {Object} options Test options
48 * @param {Object} options.description Test description 48 * @param {Object} options.description Test description
49 * @param {Object} options.numberOfInputChannels Number of input channels 49 * @param {Object} options.numberOfInputChannels Number of input channels
50 */ 50 */
51 function Test(options) { 51 function Test(should, options) {
52 52
53 // Primary test flag. 53 // Primary test flag.
54 this.success = true; 54 this.success = true;
55 55
56 this.should = should;
56 this.context = null; 57 this.context = null;
57 this.prefix = options.prefix; 58 this.prefix = options.prefix;
58 this.numberOfInputChannels = (options.numberOfInputChannels || 1); 59 this.numberOfInputChannels = (options.numberOfInputChannels || 1);
59 switch (this.numberOfInputChannels) { 60 switch (this.numberOfInputChannels) {
60 case 1: 61 case 1:
61 this.description = 'Test for mono input'; 62 this.description = 'Test for mono input';
62 break; 63 break;
63 case 2: 64 case 2:
64 this.description = 'Test for stereo input'; 65 this.description = 'Test for stereo input';
65 break; 66 break;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 }); 171 });
171 } 172 }
172 173
173 this.impulseIndex++; 174 this.impulseIndex++;
174 } 175 }
175 } 176 }
176 }; 177 };
177 178
178 179
179 Test.prototype.showResult = function () { 180 Test.prototype.showResult = function () {
180 Should(this.prefix + "Number of impulses found", this.impulseIndex) 181 this.should(this.impulseIndex, this.prefix + "Number of impulses found")
181 .beEqualTo(gNodesToCreate); 182 .beEqualTo(gNodesToCreate);
182 183
183 Should(this.prefix + "Number of impulse at the wrong offset", this.errors.le ngth) 184 this.should(this.errors.length, this.prefix + "Number of impulse at the wron g offset")
184 .beEqualTo(0); 185 .beEqualTo(0);
185 186
186 Should(this.prefix + "Left channel error magnitude", this.maxErrorL) 187 this.should(this.maxErrorL, this.prefix + "Left channel error magnitude")
187 .beLessThanOrEqualTo(this.maxAllowedError); 188 .beLessThanOrEqualTo(this.maxAllowedError);
188 189
189 Should(this.prefix + "Right channel error magnitude", this.maxErrorR) 190 this.should(this.maxErrorR, this.prefix + "Right channel error magnitude")
190 .beLessThanOrEqualTo(this.maxAllowedError); 191 .beLessThanOrEqualTo(this.maxAllowedError);
191 }; 192 };
192 193
193 194
195 /*
194 Test.prototype.finish = function () { 196 Test.prototype.finish = function () {
195 Should(this.description, this.success) 197 Should(this.description, this.success)
196 .summarize('passed', 'failed'); 198 .summarize('passed', 'failed');
197 }; 199 };
200 */
hongchan 2017/05/02 16:40:25 Please take one more look at the line 195~200.
Raymond Toy 2017/05/02 19:17:16 Done.
198 201
199 202
200 Test.prototype.run = function (done) { 203 Test.prototype.run = function () {
201 204
202 this.init(); 205 this.init();
203 this.prepare(); 206 this.prepare();
204 this.context.oncomplete = function (event) {
205 this.renderedBufferL = event.renderedBuffer.getChannelData(0);
206 this.renderedBufferR = event.renderedBuffer.getChannelData(1);
207 this.verify();
208 this.showResult();
209 this.finish();
210 done();
211 }.bind(this);
212 this.context.startRendering();
213 207
208 return this.context.startRendering()
209 .then(renderedBuffer => {
210 this.renderedBufferL = renderedBuffer.getChannelData(0);
211 this.renderedBufferR = renderedBuffer.getChannelData(1);
212 this.verify();
213 this.showResult();
214 });
214 }; 215 };
215 216
216 217
217 return { 218 return {
218 create: function (options) { 219 create: function (should, options) {
219 return new Test(options); 220 return new Test(should, options);
220 } 221 }
221 }; 222 };
222 223
223 })(); 224 })();
224 225
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/StereoPanner/stereopannernode-panning.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698