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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/wait-for-activate-worker.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/wait-for-activate-worker.js b/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/wait-for-activate-worker.js
deleted file mode 100644
index bcde69a12486397d3bb2390e48539e86db136e3e..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/resources/wait-for-activate-worker.js
+++ /dev/null
@@ -1,40 +0,0 @@
-// This worker remains in the installing phase so that the
-// navigation preload API can be tested when there is no
-// active worker.
-importScripts('../../../resources/testharness.js');
-importScripts('helpers.js');
-
-function expect_rejection(promise) {
- return promise.then(
- () => { return Promise.reject('unexpected fulfillment'); },
- err => { assert_equals('InvalidStateError', err.name); });
-}
-
-function test_before_activation() {
- const np = self.registration.navigationPreload;
- return expect_rejection(np.enable())
- .then(() => expect_rejection(np.disable()))
- .then(() => expect_rejection(np.setHeaderValue('hi')))
- .then(() => np.getState())
- .then(state => expect_navigation_preload_state(
- state, false, 'true', 'state should be the default'))
- .then(() => 'PASS')
- .catch(err => 'FAIL: ' + err);
-}
-
-var resolve_done_promise;
-var done_promise = new Promise(resolve => { resolve_done_promise = resolve; });
-
-// Run the test once the page messages this worker.
-self.addEventListener('message', e => {
- e.waitUntil(test_before_activation()
- .then(result => {
- e.source.postMessage(result);
- resolve_done_promise();
- }));
- });
-
-// Don't become the active worker until the test is done.
-self.addEventListener('install', e => {
- e.waitUntil(done_promise);
- });

Powered by Google App Engine
This is Rietveld 408576698