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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-preload/resources/wait-for-activate-worker.js

Issue 2735443002: Refactor ServiceWorker tests for inclusion in WPT (Closed)
Patch Set: Upstream service worker nav. preload tests to WPT Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // This worker remains in the installing phase so that the 1 // This worker remains in the installing phase so that the
2 // navigation preload API can be tested when there is no 2 // navigation preload API can be tested when there is no
3 // active worker. 3 // active worker.
4 importScripts('../../../resources/testharness.js'); 4 importScripts('/resources/testharness.js');
5 importScripts('helpers.js'); 5 importScripts('helpers.js');
6 6
7 function expect_rejection(promise) { 7 function expect_rejection(promise) {
8 return promise.then( 8 return promise.then(
9 () => { return Promise.reject('unexpected fulfillment'); }, 9 () => { return Promise.reject('unexpected fulfillment'); },
10 err => { assert_equals('InvalidStateError', err.name); }); 10 err => { assert_equals('InvalidStateError', err.name); });
11 } 11 }
12 12
13 function test_before_activation() { 13 function test_before_activation() {
14 const np = self.registration.navigationPreload; 14 const np = self.registration.navigationPreload;
(...skipping 16 matching lines...) Expand all
31 .then(result => { 31 .then(result => {
32 e.source.postMessage(result); 32 e.source.postMessage(result);
33 resolve_done_promise(); 33 resolve_done_promise();
34 })); 34 }));
35 }); 35 });
36 36
37 // Don't become the active worker until the test is done. 37 // Don't become the active worker until the test is done.
38 self.addEventListener('install', e => { 38 self.addEventListener('install', e => {
39 e.waitUntil(done_promise); 39 e.waitUntil(done_promise);
40 }); 40 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698