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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/resources/testharness-helpers.js

Issue 2547023002: Import wpt@3c8896ae408c8fd594979da7c99970029e7856a7 (Closed)
Patch Set: Modify TestExpectations or download new baselines for tests. Created 4 years 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * testharness-helpers contains various useful extensions to testharness.js to
3 * allow them to be used across multiple tests before they have been
4 * upstreamed. This file is intended to be usable from both document and worker
5 * environments, so code should for example not rely on the DOM.
6 */
7
8 // Returns a promise that fulfills after the provided |promise| is fulfilled.
9 // The |test| succeeds only if |promise| rejects with an exception matching
10 // |code|. Accepted values for |code| follow those accepted for assert_throws().
11 // The optional |description| describes the test being performed.
12 //
13 // E.g.:
14 // assert_promise_rejects(
15 // new Promise(...), // something that should throw an exception.
16 // 'NotFoundError',
17 // 'Should throw NotFoundError.');
18 //
19 // assert_promise_rejects(
20 // new Promise(...),
21 // new TypeError(),
22 // 'Should throw TypeError');
23 function assert_promise_rejects(promise, code, description) {
24 return promise.then(
25 function() {
26 throw 'assert_promise_rejects: ' + description + ' Promise did not reject. ';
27 },
28 function(e) {
29 if (code !== undefined) {
30 assert_throws(code, function() { throw e; }, description);
31 }
32 });
33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698