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

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

Issue 1140723003: Implement suspend() and resume() for OfflineAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Bring ToT Created 5 years, 4 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 if (window.testRunner) 1 if (window.testRunner)
2 testRunner.overridePreference("WebKitWebAudioEnabled", "1"); 2 testRunner.overridePreference("WebKitWebAudioEnabled", "1");
3 3
4 function writeString(s, a, offset) { 4 function writeString(s, a, offset) {
5 for (var i = 0; i < s.length; ++i) { 5 for (var i = 0; i < s.length; ++i) {
6 a[offset + i] = s.charCodeAt(i); 6 a[offset + i] = s.charCodeAt(i);
7 } 7 }
8 } 8 }
9 9
10 function writeInt16(n, a, offset) { 10 function writeInt16(n, a, offset) {
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 for (var i = 1; i < this.target.length; i++) { 653 for (var i = 1; i < this.target.length; i++) {
654 var diff = Math.abs(this.target[i-1] - this.target[i]); 654 var diff = Math.abs(this.target[i-1] - this.target[i]);
655 if (diff >= threshold) { 655 if (diff >= threshold) {
656 this._testFailed('has a glitch at index ' + i + ' of size ' + di ff); 656 this._testFailed('has a glitch at index ' + i + ' of size ' + di ff);
657 return; 657 return;
658 } 658 }
659 } 659 }
660 this._testPassed('has no glitch above the threshold of ' + threshold); 660 this._testPassed('has no glitch above the threshold of ' + threshold);
661 }; 661 };
662 662
663 // Check if the target promise is resolved correctly.
664 //
665 // Example:
666 // Should('My promise', promise).beResolved().then(nextStuff);
667 // Result:
668 // "PASS My promise resolved correctly."
669 // "FAIL My promise rejected incorrectly (with _ERROR_)."
670 ShouldModel.prototype.beResolved = function () {
671 return this.target.then(function () {
672 this._testPassed('resolved correctly');
673 }.bind(this), function (err) {
674 this._testFailed('rejected incorrectly (with ' + err + ')');
675 }.bind(this));
676 };
677
678 // Check if the target promise is rejected correctly.
679 //
680 // Example:
681 // Should('My promise', promise).beRejected().then(nextStuff);
682 // Result:
683 // "PASS My promise rejected correctly (with _ERROR_)."
684 // "FAIL My promise resolved incorrectly."
685 ShouldModel.prototype.beRejected = function () {
686 return this.target.then(function () {
687 this._testFailed('resolved incorrectly');
688 }.bind(this), function (err) {
689 this._testPassed('rejected correctly (with ' + err + ')');
690 }.bind(this));
691 };
692
663 // Should() method. 693 // Should() method.
664 // 694 //
665 // |desc| is the description of the task or check and |target| is a value 695 // |desc| is the description of the task or check and |target| is a value
666 // needs to be checked or a task to be performed. |opt| contains options for 696 // needs to be checked or a task to be performed. |opt| contains options for
667 // printing out log messages: options are |opt.numberOfErrorLog| and 697 // printing out log messages: options are |opt.numberOfErrorLog| and
668 // |opts.numberOfArrayLog|. 698 // |opts.numberOfArrayLog|.
669 return function (desc, target, opts) { 699 return function (desc, target, opts) {
670 var _opts = { 700 var _opts = {
671 numberOfErrorLog: 8, 701 numberOfErrorLog: 8,
672 numberOfArrayLog: 16 702 numberOfArrayLog: 16
673 }; 703 };
674 704
675 if (opts instanceof Object) { 705 if (opts instanceof Object) {
676 if (opts.hasOwnProperty('numberOfErrorLog')) 706 if (opts.hasOwnProperty('numberOfErrorLog'))
677 _opts.numberOfErrorLog = opts.numberOfErrorLog; 707 _opts.numberOfErrorLog = opts.numberOfErrorLog;
678 if (opts.hasOwnProperty('numberOfArrayLog')) 708 if (opts.hasOwnProperty('numberOfArrayLog'))
679 _opts.numberOfArrayLog = opts.numberOfArrayLog; 709 _opts.numberOfArrayLog = opts.numberOfArrayLog;
680 } 710 }
681 711
682 return new ShouldModel(desc, target, _opts); 712 return new ShouldModel(desc, target, _opts);
683 }; 713 };
684 714 })();
685 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698