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

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

Issue 2186813003: Sub-sample accurate start of OscillatorNode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust thresholds for Mac 10.11 (retina) Created 3 years, 11 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 /* global self */ 1 /* global self */
2 2
3 // testharness.js has the higher priority. 3 // testharness.js has the higher priority.
4 var TESTHARNESS = true; 4 var TESTHARNESS = true;
5 var JSTEST = false; 5 var JSTEST = false;
6 6
7 (function () { 7 (function () {
8 // Selected properies from testharness.js 8 // Selected properies from testharness.js
9 var testharnessProperties = [ 9 var testharnessProperties = [
10 'test', 'async_test', 'promise_test', 'promise_rejects', 10 'test', 'async_test', 'promise_test', 'promise_rejects',
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 return { 164 return {
165 createTaskRunner: function () { 165 createTaskRunner: function () {
166 return new Tasks(); 166 return new Tasks();
167 } 167 }
168 }; 168 };
169 169
170 })(); 170 })();
171 171
172 172
173 // Compute the (linear) signal-to-noise ratio between |actual| and |expected|. The result is NOT in
174 // dB! If the |actual| and |expected| have different lengths, the shorter lengt h is used.
175 function computeSNR(actual, expected)
176 {
177 var signalPower = 0;
178 var noisePower = 0;
179
180 var length = Math.min(actual.length, expected.length);
181
182 for (var k = 0; k < length; ++k) {
183 var diff = actual[k] - expected[k];
184 signalPower += expected[k] * expected[k];
185 noisePower += diff * diff;
186 }
187
188 return signalPower / noisePower;
189 }
190
191 // |Should| JS layout test utility. 173 // |Should| JS layout test utility.
192 // Dependency: ../resources/js-test.js 174 // Dependency: ../resources/js-test.js
193 var Should = (function () { 175 var Should = (function () {
194 176
195 'use strict'; 177 'use strict';
196 178
197 // ShouldModel internal class. For the exposed (factory) method, it is the 179 // ShouldModel internal class. For the exposed (factory) method, it is the
198 // return value of this closure. 180 // return value of this closure.
199 function ShouldModel(desc, target, opts) { 181 function ShouldModel(desc, target, opts) {
200 this.desc = desc; 182 this.desc = desc;
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 if (opts.hasOwnProperty('brief')) 912 if (opts.hasOwnProperty('brief'))
931 _opts.brief = opts.brief; 913 _opts.brief = opts.brief;
932 if (opts.hasOwnProperty('precision')) 914 if (opts.hasOwnProperty('precision'))
933 _opts.precision = opts.precision; 915 _opts.precision = opts.precision;
934 } 916 }
935 917
936 return new ShouldModel(desc, target, _opts); 918 return new ShouldModel(desc, target, _opts);
937 }; 919 };
938 920
939 })(); 921 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698