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

Unified Diff: LayoutTests/http/tests/serviceworker/resources/worker-testharness.js

Issue 647493002: Move promise_test and assert_promise_rejects out of worker-test-harness. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@geofencing_serviceworker
Patch Set: rebase Created 6 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/http/tests/serviceworker/resources/worker-test-harness.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/serviceworker/resources/worker-testharness.js
diff --git a/LayoutTests/http/tests/serviceworker/resources/worker-test-harness.js b/LayoutTests/http/tests/serviceworker/resources/worker-testharness.js
similarity index 67%
rename from LayoutTests/http/tests/serviceworker/resources/worker-test-harness.js
rename to LayoutTests/http/tests/serviceworker/resources/worker-testharness.js
index 4129f8f8178f4f42f0aa135c383b31962ea1c99b..986c86a82ed7d8960380e258e78f03d5ccdd8bf8 100644
--- a/LayoutTests/http/tests/serviceworker/resources/worker-test-harness.js
+++ b/LayoutTests/http/tests/serviceworker/resources/worker-testharness.js
@@ -72,41 +72,3 @@ 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;
- }));
-}
-
-// 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);
- }
- });
-}
« no previous file with comments | « LayoutTests/http/tests/serviceworker/resources/worker-test-harness.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698