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

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

Issue 1865103003: ServiceWorker: Add a test to check if worker is deleted after reloading iframe following unregister (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: indent Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..86ea8a95a8eed5deed14a2a98514892f2285f0b4 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,50 @@ 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';
+ var registration;
+ var frame;
+ service_worker_unregister_and_register(t, worker_url, scope)
+ .then(function(r) {
nhiroki 2016/04/07 10:27:58 Can you make indents consistent with other tests?
shimazu (google) 2016/04/08 02:09:20 Done.
+ 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 = function() { resolve(); };
nhiroki 2016/04/07 10:27:58 |frame.onload = resolve;| may work.
shimazu (google) 2016/04/08 02:09:20 Done.
+ frame.contentWindow.location.reload();
+ });
+ })
+ .then(function() {
+ return navigator.serviceWorker.register(worker_url, { scope: scope });
+ })
+ .then(function(r) {
+ registration = r;
+ assert_not_equals(r.installing, null,
+ 'installing version should exist after reloading');
+ assert_equals(r.active, null,
+ 'active version should be null after reloading');
+ return wait_for_state(t, r.installing, 'activated');
+ }).then(function (state) {
nhiroki 2016/04/07 10:27:58 - There is an extra space before |(state)|. - Can
shimazu (google) 2016/04/08 02:09:20 Done.
+ assert_equals(registration.installing, null,
+ 'installing version goes to active after activated');
nhiroki 2016/04/07 10:27:59 To identify the worker, how about keeping the inst
nhiroki 2016/04/07 10:27:59 Generally, an assertion message should have the wo
shimazu (google) 2016/04/08 02:09:20 Done.
+ assert_not_equals(registration.active, null,
+ 'installing SW comes to active after activated');
nhiroki 2016/04/07 10:27:58 There are some variants that represent service wor
shimazu (google) 2016/04/08 02:09:20 Done.
+ service_worker_unregister_and_done(t, scope);
+ })
+ .catch(unreached_rejection(t));
+ }, 'Unregister then register on the page containing iframe provided by SW ' +
+ 'should renew the SW script.');
+
+async_test(function(t) {
var scope = 'resources/scope/re-register-does-not-affect-existing-controllee';
var iframe;
var registration;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698