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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister-then-register.html

Issue 2904123002: Upstream service worker "unregister" tests to WPT (Closed)
Patch Set: Created 3 years, 7 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/unregister-then-register.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister-then-register.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister-then-register.html
deleted file mode 100644
index 75db25c1d98e67f13f35f3c9cf353cbd5bb2bef2..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister-then-register.html
+++ /dev/null
@@ -1,167 +0,0 @@
-<!DOCTYPE html>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.js"></script>
-<script>
-var worker_url = 'resources/empty-worker.js';
-
-async_test(function(t) {
- var scope = 'resources/scope/re-register-resolves-to-new-value';
- var iframe;
- var registration;
-
- service_worker_unregister_and_register(t, worker_url, scope)
- .then(function(r) {
- registration = r;
- return wait_for_state(t, r.installing, 'activated');
- })
- .then(function() {
- return registration.unregister();
- })
- .then(function() {
- return navigator.serviceWorker.register(worker_url, { scope: scope });
- })
- .then(function(new_registration) {
- assert_not_equals(registration, new_registration,
- 'register should resolve to a new value');
- service_worker_unregister_and_done(t, scope);
- })
- .catch(unreached_rejection(t));
- }, 'Unregister then register resolves to a new value');
-
-async_test(function(t) {
- var scope = 'resources/scope/re-register-while-old-registration-in-use';
- var registration;
-
- service_worker_unregister_and_register(t, worker_url, scope)
- .then(function(r) {
- registration = r;
- return wait_for_state(t, r.installing, 'activated');
- })
- .then(function() {
- return with_iframe(scope);
- })
- .then(function(frame) {
- return registration.unregister();
- })
- .then(function() {
- return navigator.serviceWorker.register(worker_url, { scope: scope });
- })
- .then(function(new_registration) {
- assert_equals(registration, new_registration,
- 'register should resolve to the same registration');
- service_worker_unregister_and_done(t, scope);
- })
- .catch(unreached_rejection(t));
- }, 'Unregister then register resolves to the original value if the ' +
- 'registration is in use.');
-
-async_test(function(t) {
- var scope = 'resources/scope/complete-unregistration-followed-by-' +
- 'reloading-controllee-iframe';
- var registration;
- var frame;
- var service_worker;
- service_worker_unregister_and_register(t, worker_url, scope)
- .then(function(r) {
- registration = r;
- return wait_for_state(t, r.installing, 'activated');
- })
- .then(function() {
- return with_iframe(scope);
- })
- .then(function(f) {
- frame = f;
- return registration.unregister();
- })
- .then(function() {
- return new Promise(function(resolve) {
- frame.onload = resolve;
- frame.contentWindow.location.reload();
- });
- })
- .then(function() {
- var c = frame.contentWindow.navigator.serviceWorker.controller;
- assert_equals(c, null, 'a page after unregistration should not be ' +
- 'controlled by service worker');
- return navigator.serviceWorker.getRegistration(scope);
- })
- .then(function(r) {
- assert_equals(r, undefined, 'getRegistration should return ' +
- 'undefined after unregistration');
- service_worker_unregister_and_done(t, scope);
- })
- .catch(unreached_rejection(t));
-}, 'Reloading the last controlled iframe after unregistration should ensure ' +
- 'the deletion of the registration');
-
-async_test(function(t) {
- var scope = 'resources/scope/re-register-does-not-affect-existing-controllee';
- var iframe;
- var registration;
- var controller;
-
- service_worker_unregister_and_register(t, worker_url, scope)
- .then(function(r) {
- registration = r;
- return wait_for_state(t, r.installing, 'activated');
- })
- .then(function() {
- return with_iframe(scope);
- })
- .then(function(frame) {
- iframe = frame;
- controller = iframe.contentWindow.navigator.serviceWorker.controller;
- return registration.unregister();
- })
- .then(function() {
- return navigator.serviceWorker.register(worker_url, { scope: scope });
- })
- .then(function(registration) {
- assert_equals(registration.installing, null,
- 'installing version is null');
- assert_equals(registration.waiting, null, 'waiting version is null');
- assert_equals(
- iframe.contentWindow.navigator.serviceWorker.controller,
- controller,
- 'the worker from the first registration is the controller');
- service_worker_unregister_and_done(t, scope);
- })
- .catch(unreached_rejection(t));
- }, 'Unregister then register does not affect existing controllee');
-
-async_test(function(t) {
- var scope = 'resources/scope/resurrection';
- var iframe;
- var registration;
-
- service_worker_unregister_and_register(t, worker_url, scope)
- .then(function(r) {
- registration = r;
- return wait_for_state(t, r.installing, 'activated');
- })
- .then(function() {
- return with_iframe(scope);
- })
- .then(function(frame) {
- iframe = frame;
- return registration.unregister();
- })
- .then(function() {
- return navigator.serviceWorker.register(worker_url, { scope: scope });
- })
- .then(function() {
- iframe.remove();
- return with_iframe(scope);
- })
- .then(function(frame) {
- // FIXME: When crbug.com/400602 is fixed, assert that controller
- // equals the original worker.
- assert_not_equals(
- frame.contentWindow.navigator.serviceWorker.controller, null,
- 'document should have a controller');
- service_worker_unregister_and_done(t, scope);
- })
- .catch(unreached_rejection(t));
- }, 'Unregister then register resurrects the registration');
-</script>

Powered by Google App Engine
This is Rietveld 408576698