Chromium Code Reviews| Index: LayoutTests/http/tests/serviceworker/resources/worker-test-harness.js |
| diff --git a/LayoutTests/http/tests/serviceworker/resources/worker-test-harness.js b/LayoutTests/http/tests/serviceworker/resources/worker-test-harness.js |
| index 1d3a5f576840015fc44df81b7e357ab7c5e76b51..d97813fdca1bc132c6484605f8673b3cf787018d 100644 |
| --- a/LayoutTests/http/tests/serviceworker/resources/worker-test-harness.js |
| +++ b/LayoutTests/http/tests/serviceworker/resources/worker-test-harness.js |
| @@ -84,3 +84,22 @@ function promise_test(func, name, properties) { |
| throw value; |
| })); |
| } |
| + |
| +// Returns promise that fulfills after the provided |promise| is fulfilled. The |
|
jsbell
2014/08/15 21:36:13
nit: Returns a promise...
asanka
2014/08/20 03:10:29
Done.
|
| +// |test| succeeds only if |promise| throws a DOM exception matching |code|. The |
|
jsbell
2014/08/15 21:36:13
I don't believe this needs to be a DOMException, e
asanka
2014/08/20 03:10:29
Changed.
|
| +// optional |description| describes the test being performed. |
| +// E.g.: |
| +// expect_promise_throws( |
| +// test, new Promise(...), // something that should throw |
| +// // a DOM exception. |
| +// 'NotFoundError', |
| +// 'Should throw NotFoundError.'); |
| +function expect_promise_throws(test, promise, code, description) { |
| + return promise.then( |
| + test.step_func(function() { |
| + throw "expect_promise_throws: " + description + " Promise did now throw." |
|
jsbell
2014/08/15 21:36:13
Use assert_unreached or unreached_func?
jsbell
2014/08/15 21:36:13
nit: line length (80 cols)
asanka
2014/08/20 03:10:29
Looks like it's exactly 80?
Also I chose to throw
|
| + }), |
| + test.step_func(function(e) { |
| + assert_throws(code, function() { throw e; }, description); |
| + })); |
| +} |