Chromium Code Reviews| 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 |
| index cec2ddc85410777c300e6c0b14e1fdf958173378..4fba0ed38d77cf7ce7b8431ea7d5b0614f2269c9 100644 |
| --- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister-then-register.html |
| +++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister-then-register.html |
| @@ -57,6 +57,55 @@ async_test(function(t) { |
| 'registration is in use.'); |
| async_test(function(t) { |
| + var scope = 'resources/scope/re-register-after-reloading-iframe-' + |
| + 'with-old-registration-in-use'; |
|
nhiroki
2016/04/11 05:33:13
I'm wondering if we could minimize this test.
Wha
shimazu (google)
2016/04/11 06:58:15
I checked if getRegistration returns not null befo
|
| + var old_registration; |
| + var new_registration; |
| + var frame; |
| + var service_worker; |
| + service_worker_unregister_and_register(t, worker_url, scope) |
| + .then(function(r) { |
| + old_registration = r; |
| + return wait_for_state(t, r.installing, 'activated'); |
| + }) |
| + .then(function() { |
| + return with_iframe(scope); |
| + }) |
| + .then(function(f) { |
| + frame = f; |
| + return old_registration.unregister(); |
| + }) |
| + .then(function() { |
| + return new Promise(function(resolve) { |
| + frame.onload = resolve; |
| + frame.contentWindow.location.reload(); |
| + }); |
| + }) |
| + .then(function() { |
| + return navigator.serviceWorker.register(worker_url, { scope: scope }); |
| + }) |
| + .then(function(new_registration) { |
| + assert_not_equals(new_registration, old_registration, |
| + 'registration of the same scope after ' + |
| + 'reloading should be updated'); |
| + navigator.serviceWorker.getRegistration(scope) |
|
nhiroki
2016/04/11 05:33:13
To reduce the nest level, you can return the promi
shimazu (google)
2016/04/11 06:58:15
Thanks! Done.
|
| + .then(function(r) { |
| + assert_not_equals(r, old_registration, |
| + 'getRegistration after reloading should ' + |
| + 'not get the old registration before ' + |
| + 'reloading'); |
| + assert_equals(r, new_registration, |
| + 'getRegistration should bring the latest ' + |
| + 'registration'); |
| + service_worker_unregister_and_done(t, scope); |
| + }); |
| + }) |
| + .catch(unreached_rejection(t)); |
| +}, 'Unregistration followed by reloading the iframe provided by a ' + |
| + 'service worker should unregister successfully and new registration later ' + |
| + 'should be active'); |
| + |
| +async_test(function(t) { |
| var scope = 'resources/scope/re-register-does-not-affect-existing-controllee'; |
| var iframe; |
| var registration; |