Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/webaudio/resources/audit.js |
| diff --git a/third_party/WebKit/LayoutTests/webaudio/resources/audit.js b/third_party/WebKit/LayoutTests/webaudio/resources/audit.js |
| index 117bce61ee63b8cb0aa817ddc72961f881c0b4eb..9c9fa5a3528e0a17e19c3626716ecbe7c2dddf62 100644 |
| --- a/third_party/WebKit/LayoutTests/webaudio/resources/audit.js |
| +++ b/third_party/WebKit/LayoutTests/webaudio/resources/audit.js |
| @@ -357,6 +357,39 @@ window.Audit = (function () { |
| } |
| /** |
| + * Check if |actual| promise is rejected correctly. |
| + * |
| + * @example |
| + * should('My promise', promise).beRejectedWith('_ERROR_').then(); |
|
Raymond Toy
2017/01/23 23:11:57
This is backward, right? |promise| should be the f
hongchan
2017/01/23 23:14:50
Done.
|
| + * |
| + * @result |
| + * "PASS My promise rejected correctly with _ERROR_." |
| + * "FAIL X My promise rejected correctly but got _ACTUAL_ERROR instead of |
| + * _EXPECTED_ERROR_." |
| + * "FAIL X My promise resolved incorrectly." |
| + */ |
| + beRejectedWith() { |
| + this._processArguments(arguments); |
| + |
| + return this._actual.then( |
| + function() { |
| + this._assert(false, null, '${actual} resolved incorrectly.'); |
| + }.bind(this), |
| + function(error) { |
| + if (this._expected !== error.name) { |
| + this._assert( |
| + false, null, '${actual} rejected correctly but got ' + |
| + error.name + ' instead of ' + this._expected + '.'); |
| + } else { |
| + this._assert( |
| + true, |
| + '${actual} rejected correctly with ' + this._expected + '.', |
| + null); |
| + } |
| + }.bind(this)); |
| + } |
| + |
| + /** |
| * Check if |actual| is a boolean true. |
| * |
| * @example |