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

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: Updating UseCounter.h after L-G-T-M Created 5 years 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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 var diff = Math.abs(this.target[i-1] - this.target[i]); 778 var diff = Math.abs(this.target[i-1] - this.target[i]);
779 if (diff >= threshold) { 779 if (diff >= threshold) {
780 this._testFailed('has a glitch at index ' + i + ' of size ' + di ff); 780 this._testFailed('has a glitch at index ' + i + ' of size ' + di ff);
781 return this._success; 781 return this._success;
782 } 782 }
783 } 783 }
784 this._testPassed('has no glitch above the threshold of ' + threshold); 784 this._testPassed('has no glitch above the threshold of ' + threshold);
785 return this._success; 785 return this._success;
786 }; 786 };
787 787
788 // Check if the target promise is resolved correctly.
789 //
790 // Example:
791 // Should('My promise', promise).beResolved().then(nextStuff);
792 // Result:
793 // "PASS My promise resolved correctly."
794 // "FAIL My promise rejected incorrectly (with _ERROR_)."
795 ShouldModel.prototype.beResolved = function () {
796 return this.target.then(function () {
797 this._testPassed('resolved correctly');
798 }.bind(this), function (err) {
799 this._testFailed('rejected incorrectly (with ' + err + ')');
800 }.bind(this));
801 };
802
803 // Check if the target promise is rejected correctly.
804 //
805 // Example:
806 // Should('My promise', promise).beRejected().then(nextStuff);
807 // Result:
808 // "PASS My promise rejected correctly (with _ERROR_)."
809 // "FAIL My promise resolved incorrectly."
810 ShouldModel.prototype.beRejected = function () {
811 return this.target.then(function () {
812 this._testFailed('resolved incorrectly');
813 }.bind(this), function (err) {
814 this._testPassed('rejected correctly (with ' + err + ')');
815 }.bind(this));
816 };
817
788 // Should() method. 818 // Should() method.
789 // 819 //
790 // |desc| is the description of the task or check and |target| is a value 820 // |desc| is the description of the task or check and |target| is a value
791 // needs to be checked or a task to be performed. |opt| contains options for 821 // needs to be checked or a task to be performed. |opt| contains options for
792 // printing out log messages: options are |opt.numberOfErrorLog| and 822 // printing out log messages: options are |opt.numberOfErrorLog| and
793 // |opts.numberOfArrayLog|. 823 // |opts.numberOfArrayLog|.
794 return function (desc, target, opts) { 824 return function (desc, target, opts) {
795 var _opts = { 825 var _opts = {
796 numberOfErrorLog: 8, 826 numberOfErrorLog: 8,
797 numberOfArrayLog: 16 827 numberOfArrayLog: 16
798 }; 828 };
799 829
800 if (opts instanceof Object) { 830 if (opts instanceof Object) {
801 if (opts.hasOwnProperty('numberOfErrorLog')) 831 if (opts.hasOwnProperty('numberOfErrorLog'))
802 _opts.numberOfErrorLog = opts.numberOfErrorLog; 832 _opts.numberOfErrorLog = opts.numberOfErrorLog;
803 if (opts.hasOwnProperty('numberOfArrayLog')) 833 if (opts.hasOwnProperty('numberOfArrayLog'))
804 _opts.numberOfArrayLog = opts.numberOfArrayLog; 834 _opts.numberOfArrayLog = opts.numberOfArrayLog;
805 } 835 }
806 836
807 return new ShouldModel(desc, target, _opts); 837 return new ShouldModel(desc, target, _opts);
808 }; 838 };
809 839
810 })(); 840 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698