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

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

Issue 430993002: [ServiceWorker] CacheStorage tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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/test-helpers.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-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..56840e1661afd17a629f89c801fe898024dfa99a 100644
--- a/LayoutTests/http/tests/serviceworker/resources/worker-test-harness.js
+++ b/LayoutTests/http/tests/serviceworker/resources/worker-test-harness.js
@@ -84,3 +84,21 @@ function promise_test(func, name, properties) {
throw value;
}));
}
+
+// Returns a promise that fulfills after the provided |promise| is fulfilled.
+// The |test| succeeds only if |promise| throws an exception matching |code|.
+// The optional |description| describes the test being performed.
+// E.g.:
+// assert_promise_throws(
+// new Promise(...), // something that should throw an exception.
+// 'NotFoundError',
+// 'Should throw NotFoundError.');
+function assert_promise_throws(promise, code, description) {
jsbell 2014/09/11 22:27:30 Can we rename this to assert_promise_rejects since
asanka 2014/09/24 03:28:55 Done.
+ return promise.then(
+ function() {
+ throw 'assert_promise_throws: ' + description + ' Promise did not throw.';
+ },
+ function(e) {
+ assert_throws(code, function() { throw e; }, description);
+ });
+}
« no previous file with comments | « LayoutTests/http/tests/serviceworker/resources/test-helpers.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698