Index: LayoutTests/webaudio/resources/audio-testing.js |
diff --git a/LayoutTests/webaudio/resources/audio-testing.js b/LayoutTests/webaudio/resources/audio-testing.js |
index c4a791ce57a2cfcb567a4a8bc112c9ba4f1e8c91..bd7f5b8f572d1bea128c44b3c18e131686fdb6a3 100644 |
--- a/LayoutTests/webaudio/resources/audio-testing.js |
+++ b/LayoutTests/webaudio/resources/audio-testing.js |
@@ -631,6 +631,34 @@ var Should = (function () { |
this._testPassed('has no glitch above the threshold of ' + threshold); |
}; |
+ // Check if the target promise is resolved correctly. |
+ // |
+ // Example: |
+ // Should('My promise', promise).beResolved().then(nextStuff); |
+ // Result: |
+ // "PASS My promise resolved correctly." |
Raymond Toy
2015/06/12 21:11:36
We should do this everywhere, but I think we shoul
hongchan
2015/06/15 18:40:46
Done.
|
+ ShouldModel.prototype.beResolved = function () { |
+ return this.target.then(function () { |
+ this._testPassed('resolved correctly'); |
+ }.bind(this), function (err) { |
+ this._testFailed('rejected incorrectly (with ' + err + ')'); |
+ }.bind(this)); |
+ }; |
+ |
+ // Check if the target promise is rejected correctly. |
+ // |
+ // Example: |
+ // Should('My promise', promise).beRejected().then(nextStuff); |
+ // Result: |
+ // "PASS My promise rejected correctly." |
+ ShouldModel.prototype.beRejected = function () { |
+ return this.target.then(function () { |
+ this._testFailed('resolved incorrectly'); |
+ }.bind(this), function (err) { |
+ this._testPassed('rejected correctly (with ' + err + ')'); |
+ }.bind(this)); |
+ }; |
+ |
// Should() method. |
// |
// |desc| is the description of the task or check and |target| is a value |
@@ -652,5 +680,4 @@ var Should = (function () { |
return new ShouldModel(desc, target, _opts); |
}; |
- |
-})(); |
+})(); |