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

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

Issue 1405413004: Implement suspend() and resume() for OfflineAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing feedback Created 5 years, 2 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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 var diff = Math.abs(this.target[i-1] - this.target[i]); 758 var diff = Math.abs(this.target[i-1] - this.target[i]);
759 if (diff >= threshold) { 759 if (diff >= threshold) {
760 this._testFailed('has a glitch at index ' + i + ' of size ' + di ff); 760 this._testFailed('has a glitch at index ' + i + ' of size ' + di ff);
761 return this._success; 761 return this._success;
762 } 762 }
763 } 763 }
764 this._testPassed('has no glitch above the threshold of ' + threshold); 764 this._testPassed('has no glitch above the threshold of ' + threshold);
765 return this._success; 765 return this._success;
766 }; 766 };
767 767
768 // Check if the target promise is resolved correctly.
769 //
770 // Example:
771 // Should('My promise', promise).beResolved().then(nextStuff);
772 // Result:
773 // "PASS My promise resolved correctly."
774 // "FAIL My promise rejected incorrectly (with _ERROR_)."
775 ShouldModel.prototype.beResolved = function () {
776 return this.target.then(function () {
777 this._testPassed('resolved correctly');
778 }.bind(this), function (err) {
779 this._testFailed('rejected incorrectly (with ' + err + ')');
780 }.bind(this));
781 };
782
783 // Check if the target promise is rejected correctly.
784 //
785 // Example:
786 // Should('My promise', promise).beRejected().then(nextStuff);
787 // Result:
788 // "PASS My promise rejected correctly (with _ERROR_)."
789 // "FAIL My promise resolved incorrectly."
790 ShouldModel.prototype.beRejected = function () {
791 return this.target.then(function () {
792 this._testFailed('resolved incorrectly');
793 }.bind(this), function (err) {
794 this._testPassed('rejected correctly (with ' + err + ')');
795 }.bind(this));
796 };
797
768 // Should() method. 798 // Should() method.
769 // 799 //
770 // |desc| is the description of the task or check and |target| is a value 800 // |desc| is the description of the task or check and |target| is a value
771 // needs to be checked or a task to be performed. |opt| contains options for 801 // needs to be checked or a task to be performed. |opt| contains options for
772 // printing out log messages: options are |opt.numberOfErrorLog| and 802 // printing out log messages: options are |opt.numberOfErrorLog| and
773 // |opts.numberOfArrayLog|. 803 // |opts.numberOfArrayLog|.
774 return function (desc, target, opts) { 804 return function (desc, target, opts) {
775 var _opts = { 805 var _opts = {
776 numberOfErrorLog: 8, 806 numberOfErrorLog: 8,
777 numberOfArrayLog: 16 807 numberOfArrayLog: 16
778 }; 808 };
779 809
780 if (opts instanceof Object) { 810 if (opts instanceof Object) {
781 if (opts.hasOwnProperty('numberOfErrorLog')) 811 if (opts.hasOwnProperty('numberOfErrorLog'))
782 _opts.numberOfErrorLog = opts.numberOfErrorLog; 812 _opts.numberOfErrorLog = opts.numberOfErrorLog;
783 if (opts.hasOwnProperty('numberOfArrayLog')) 813 if (opts.hasOwnProperty('numberOfArrayLog'))
784 _opts.numberOfArrayLog = opts.numberOfArrayLog; 814 _opts.numberOfArrayLog = opts.numberOfArrayLog;
785 } 815 }
786 816
787 return new ShouldModel(desc, target, _opts); 817 return new ShouldModel(desc, target, _opts);
788 }; 818 };
789 819
790 })(); 820 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698