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

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

Issue 2102133002: Add constructors for WebAudio nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and prefix use counter names with WebAudio Created 4 years, 3 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 484
485 // If true, verbose output for the failure case is printed, for methods where this makes 485 // If true, verbose output for the failure case is printed, for methods where this makes
486 // sense. 486 // sense.
487 this.verbose = !opts.brief; 487 this.verbose = !opts.brief;
488 488
489 // If set, this is the precision with which numbers will be printed. 489 // If set, this is the precision with which numbers will be printed.
490 this.PRINT_PRECISION = opts.precision; 490 this.PRINT_PRECISION = opts.precision;
491 } 491 }
492 492
493 // Internal methods starting with a underscore. 493 // Internal methods starting with a underscore.
494 ShouldModel.prototype._testPassed = function (msg) { 494 ShouldModel.prototype._testPassed = function (msg, addNewline) {
495 this._success = true; 495 this._success = true;
496 var newLine = addNewline ? '\n' : '';
496 if (TESTHARNESS) { 497 if (TESTHARNESS) {
497 // Using testharness.js 498 // Using testharness.js
498 test(function () { 499 test(function () {
499 assert_true(true); 500 assert_true(true);
500 }, this.desc + ' ' + msg + '.'); 501 }, this.desc + ' ' + msg + '.' + newLine);
501 } else { 502 } else {
502 // Using js-test.js 503 // Using js-test.js
503 testPassed(this.desc + ' ' + msg + '.'); 504 testPassed(this.desc + ' ' + msg + '.' + newLine);
504 } 505 }
505 }; 506 };
506 507
507 ShouldModel.prototype._testFailed = function (msg) { 508 ShouldModel.prototype._testFailed = function (msg, addNewline) {
508 this._success = false; 509 this._success = false;
509 var that = this; 510 var that = this;
511 var newLine = addNewline ? '\n' : '';
510 if (TESTHARNESS) { 512 if (TESTHARNESS) {
511 test(function () { 513 test(function () {
512 assert_true(false, that.desc + ' ' + msg + '.'); 514 assert_true(false, that.desc + ' ' + msg + '.' + newLine);
513 }, this.desc); 515 }, this.desc);
514 } else { 516 } else {
515 testFailed(this.desc + ' ' + msg + '.'); 517 testFailed(this.desc + ' ' + msg + '.' + newLine);
516 } 518 }
517 }; 519 };
518 520
519 ShouldModel.prototype._isArray = function (arg) { 521 ShouldModel.prototype._isArray = function (arg) {
520 return arg instanceof Array || arg instanceof Float32Array || arg instance of Uint8Array || 522 return arg instanceof Array || arg instanceof Float32Array || arg instance of Uint8Array ||
521 arg instanceof Uint16Array || arg instanceof Uint32Array || arg instance of Int8Array || 523 arg instanceof Uint16Array || arg instanceof Uint32Array || arg instance of Int8Array ||
522 arg instanceof Int16Array || arg instanceof Int32Array || arg instanceof Uint8ClampedArray || 524 arg instanceof Int16Array || arg instanceof Int32Array || arg instanceof Uint8ClampedArray ||
523 arg instanceof Float64Array; 525 arg instanceof Float64Array;
524 }; 526 };
525 527
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 }; 646 };
645 647
646 // Check if |target| is not equal to |value|. 648 // Check if |target| is not equal to |value|.
647 // 649 //
648 // Example: 650 // Example:
649 // Should('One', one).notBeEqualTo(0); 651 // Should('One', one).notBeEqualTo(0);
650 // Result: 652 // Result:
651 // "PASS One is not equal to 0." 653 // "PASS One is not equal to 0."
652 ShouldModel.prototype.notBeEqualTo = function (value) { 654 ShouldModel.prototype.notBeEqualTo = function (value) {
653 var type = typeof value; 655 var type = typeof value;
654 this._assert(type === 'number' || type === 'string', 656 this._assert(type === 'number' || type === 'string' || type === "boolean ",
655 'value should be number or string for', value); 657 'value should be number, string, or boolean for', value);
656 658
657 this._checkNaN(value, 'EXPECTED'); 659 this._checkNaN(value, 'EXPECTED');
658 660
659 if (this.target === value) 661 if (this.target === value)
660 this._testFailed('should not be equal to ' + value); 662 this._testFailed('should not be equal to ' + value);
661 else 663 else
662 this._testPassed('is not equal to ' + value); 664 this._testPassed('is not equal to ' + value);
663 return this._success; 665 return this._success;
664 }; 666 };
665 667
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 1160
1159 // A summary message 1161 // A summary message
1160 // 1162 //
1161 // Example: 1163 // Example:
1162 // Should("Summary1", true).summarize("passed1", "failed1"); 1164 // Should("Summary1", true).summarize("passed1", "failed1");
1163 // Should("Summary2", false).summarize("passed2", "failed2"); 1165 // Should("Summary2", false).summarize("passed2", "failed2");
1164 // Result: 1166 // Result:
1165 // "PASS Summary1: passed1." 1167 // "PASS Summary1: passed1."
1166 // "FAIL Summary2: failed2." 1168 // "FAIL Summary2: failed2."
1167 ShouldModel.prototype.summarize = function (pass, fail) { 1169 ShouldModel.prototype.summarize = function (pass, fail) {
1170 // It's really nice to have blank lines after the summary, but
1171 // testharness thinks the whole testsuite fails if we do that.
1168 if (this.target) 1172 if (this.target)
1169 this._testPassed(pass); 1173 this._testPassed(pass, false);
1170 else 1174 else
1171 this._testFailed(fail); 1175 this._testFailed(fail, false);
1172 return this._success; 1176 return this._success;
1173 } 1177 }
1174 1178
1175 // Should() method. 1179 // Should() method.
1176 // 1180 //
1177 // |desc| is the description of the task or check and |target| is a value 1181 // |desc| is the description of the task or check and |target| is a value
1178 // needs to be checked or a task to be performed. |opt| contains options for 1182 // needs to be checked or a task to be performed. |opt| contains options for
1179 // printing out log messages: options are |opt.numberOfErrorLog| and 1183 // printing out log messages: options are |opt.numberOfErrorLog| and
1180 // |opts.numberOfArrayLog|. 1184 // |opts.numberOfArrayLog|.
1181 return function (desc, target, opts) { 1185 return function (desc, target, opts) {
(...skipping 11 matching lines...) Expand all
1193 if (opts.hasOwnProperty('brief')) 1197 if (opts.hasOwnProperty('brief'))
1194 _opts.brief = opts.brief; 1198 _opts.brief = opts.brief;
1195 if (opts.hasOwnProperty('precision')) 1199 if (opts.hasOwnProperty('precision'))
1196 _opts.precision = opts.precision; 1200 _opts.precision = opts.precision;
1197 } 1201 }
1198 1202
1199 return new ShouldModel(desc, target, _opts); 1203 return new ShouldModel(desc, target, _opts);
1200 }; 1204 };
1201 1205
1202 })(); 1206 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698