Index: LayoutTests/http/tests/serviceworker/multiple-register.html |
diff --git a/LayoutTests/http/tests/serviceworker/multiple-register.html b/LayoutTests/http/tests/serviceworker/multiple-register.html |
index 34793a521b1b56bc0735c37e26915f7b361cf00a..08514cb3c63c16e0056dbb8c017ef36601bb18b0 100644 |
--- a/LayoutTests/http/tests/serviceworker/multiple-register.html |
+++ b/LayoutTests/http/tests/serviceworker/multiple-register.html |
@@ -8,28 +8,36 @@ var worker_url = 'resources/empty-worker.js'; |
async_test(function(t) { |
var scope = 'scope/subsequent-register'; |
var worker; |
+ var previous_registration; |
service_worker_unregister_and_register(t, worker_url, scope) |
- .then(function(registered_worker) { |
- worker = registered_worker; |
+ .then(function(registration) { |
+ previous_registration = registration; |
+ return wait_for_update(t, registration); |
+ }) |
+ .then(function(installing_worker) { |
+ worker = installing_worker; |
return wait_for_state(t, worker, 'activated'); |
}) |
.then(function() { |
return navigator.serviceWorker.register(worker_url, { scope: scope }); |
}) |
- .then(function(registered_worker) { |
- assert_equals(registered_worker, worker, |
- 'register should resolve to the same worker'); |
- assert_equals(registered_worker.state, 'activated', |
- 'the worker should be in state "activated"'); |
+ .then(function(registration) { |
+ assert_equals(previous_registration, registration, |
+ 'register should resolve to the same registration'); |
+ // FIXME: When crbug.com/400602 is fixed, assert that active equals the |
+ // original worker. |
+ assert_not_equals(registration.active, worker, |
+ 'register should resolve to the same worker'); |
+ assert_equals(registration.active.state, 'activated', |
+ 'the worker should be in state "activated"'); |
service_worker_unregister_and_done(t, scope); |
}) |
.catch(unreached_rejection(t)); |
-}, 'Subsequent registrations resolve to the same worker'); |
+}, 'Subsequent registrations resolve to the same registration object'); |
async_test(function(t) { |
var scope = 'scope/concurrent-register'; |
- var worker; |
navigator.serviceWorker.unregister(scope) |
.then(function() { |
@@ -40,33 +48,34 @@ async_test(function(t) { |
} |
return Promise.all(promises); |
}) |
- .then(function(workers) { |
- workers.forEach(function(worker) { |
- assert_equals(worker, workers[0], |
- 'register should resolve to the same worker'); |
+ .then(function(registrations) { |
+ registrations.forEach(function(registration) { |
+ assert_equals(registration, registrations[0], |
+ 'register should resolve to the same registration'); |
}); |
service_worker_unregister_and_done(t, scope); |
}) |
.catch(unreached_rejection(t)); |
-}, 'Concurrent registrations resolve to the same worker'); |
+}, 'Concurrent registrations resolve to the same registration object'); |
async_test(function(t) { |
var scope = 'scope/multiple-frames'; |
- var worker; |
+ var previous_registration; |
service_worker_unregister_and_register(t, worker_url, scope) |
- .then(function(registered_worker) { |
- worker = registered_worker; |
+ .then(function(registration) { |
+ previous_registration = registration; |
return with_iframe('nothing-here.html'); |
}) |
.then(function(frame) { |
return frame.contentWindow.navigator.serviceWorker.register( |
worker_url, { scope: scope }); |
}) |
- .then(function(registered_worker) { |
- assert_not_equals(registered_worker, worker); |
+ .then(function(registration) { |
+ assert_not_equals(previous_registration, registration); |
service_worker_unregister_and_done(t, scope); |
}) |
.catch(unreached_rejection(t)); |
- }, 'Registrations in separate frames resolve to different workers'); |
+ }, 'Registrations in separate frames resolve to different ' + |
+ 'registration objects'); |
</script> |