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 4129f8f8178f4f42f0aa135c383b31962ea1c99b..cb2bcfcd7c991071d13be0e9bad1816d23d1e972 100644 |
| --- a/LayoutTests/http/tests/serviceworker/resources/worker-test-harness.js |
| +++ b/LayoutTests/http/tests/serviceworker/resources/worker-test-harness.js |
| @@ -73,40 +73,5 @@ importScripts('/resources/testharness.js'); |
| }); |
| })(); |
| -// 'promise_test' is a new kind of testharness test that handles some |
| -// boilerplate for testing with promises. |
| -function promise_test(func, name, properties) { |
| - properties = properties || {}; |
| - var test = async_test(name, properties); |
| - Promise.resolve(test.step(func, test, test)) |
| - .then(function() { test.done(); }) |
| - .catch(test.step_func(function(value) { |
| - throw value; |
| - })); |
| -} |
| +importScripts('/resources/testharness-helpers.js'); |
|
jsbell
2014/10/10 17:18:07
After some pondering, I think we should probably r
asanka
2014/10/10 19:39:11
+1. I also don't feel strongly, but I'm in favor o
Marijn Kruisselbrink
2014/10/10 20:32:55
Done.
|
| -// Returns a promise that fulfills after the provided |promise| is fulfilled. |
| -// The |test| succeeds only if |promise| rejects with an exception matching |
| -// |code|. Accepted values for |code| follow those accepted for assert_throws(). |
| -// The optional |description| describes the test being performed. |
| -// E.g.: |
| -// assert_promise_rejects( |
| -// new Promise(...), // something that should throw an exception. |
| -// 'NotFoundError', |
| -// 'Should throw NotFoundError.'); |
| -// |
| -// assert_promise_rejects( |
| -// new Promise(...), |
| -// new TypeError(), |
| -// 'Should throw TypeError'); |
| -function assert_promise_rejects(promise, code, description) { |
| - return promise.then( |
| - function() { |
| - throw 'assert_promise_rejects: ' + description + ' Promise did not throw.'; |
| - }, |
| - function(e) { |
| - if (code !== undefined) { |
| - assert_throws(code, function() { throw e; }, description); |
| - } |
| - }); |
| -} |