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

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
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);
+ }));
+}

Powered by Google App Engine
This is Rietveld 408576698