Chromium Code Reviews| 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..c42afbd0af1a6cdc67fcf865f39608c3e26262c7 100644 |
| --- a/LayoutTests/http/tests/serviceworker/multiple-register.html |
| +++ b/LayoutTests/http/tests/serviceworker/multiple-register.html |
| @@ -8,8 +8,13 @@ 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(registration) { |
| + previous_registration = registration; |
|
falken
2014/08/14 14:23:14
indent
nhiroki
2014/08/14 16:37:53
Done.
|
| + return wait_for_update(t, registration); |
| + }) |
| .then(function(registered_worker) { |
|
falken
2014/08/14 14:23:14
nit: this is archaic naming now. installing_worker
nhiroki
2014/08/14 16:37:53
Done.
|
| worker = registered_worker; |
| return wait_for_state(t, worker, 'activated'); |
| @@ -17,19 +22,22 @@ async_test(function(t) { |
| .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> |