Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/registration-attribute.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/registration-attribute.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/registration-attribute.html |
index 688fc0cec481a2de6eec56fee555affb2303987a..cfd6dfab387af97ff61632d2d856b76ec224f958 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/registration-attribute.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/registration-attribute.html |
@@ -32,6 +32,70 @@ promise_test(function(t) { |
frame.remove(); |
return service_worker_unregister_and_done(t, scope); |
}); |
- }, 'Verify registration attribute on ServiceWorkerGlobalScope'); |
+ }, 'Verify registration attributes on ServiceWorkerGlobalScope'); |
+ |
+promise_test(function(t) { |
+ var script = 'resources/registration-attribute-worker.js'; |
+ var newer_script = 'resources/registration-attribute-newer-worker.js'; |
+ var scope = 'resources/scope/registration-attribute'; |
+ var newer_worker; |
+ |
+ return service_worker_unregister_and_register(t, script, scope) |
+ .then(function(registration) { |
+ return wait_for_state(t, registration.installing, 'activated'); |
+ }) |
+ .then(function() { |
+ return navigator.serviceWorker.register(newer_script, {scope: scope}); |
+ }) |
+ .then(function(registration) { |
+ newer_worker = registration.installing; |
+ return wait_for_state(t, registration.installing, 'activated'); |
+ }) |
+ .then(function() { |
+ var channel = new MessageChannel; |
+ var sawMessage = new Promise(function(resolve) { |
falken
2015/11/19 01:29:22
nit: saw_message
nhiroki
2015/11/19 09:02:54
Done.
|
+ channel.port1.onmessage = function(e) { resolve(e.data); }; |
+ }); |
+ newer_worker.postMessage({port: channel.port2}, [channel.port2]); |
+ return sawMessage; |
+ }) |
+ .then(function(results) { |
+ var script_url = normalizeURL(script); |
+ var newer_script_url = normalizeURL(newer_script); |
+ var expectations = [ |
+ 'evaluate', |
+ ' installing: empty', |
+ ' waiting: empty', |
+ ' active: ' + script_url, |
+ 'updatefound', |
+ ' installing: ' + newer_script_url, |
+ ' waiting: empty', |
+ ' active: ' + script_url, |
+ 'install', |
+ ' installing: ' + newer_script_url, |
+ ' waiting: empty', |
+ ' active: ' + script_url, |
+ 'statechange(installed)', |
+ ' installing: empty', |
+ ' waiting: ' + newer_script_url, |
+ ' active: ' + script_url, |
+ 'statechange(activating)', |
+ ' installing: empty', |
+ ' waiting: empty', |
+ ' active: ' + newer_script_url, |
+ 'activate', |
+ ' installing: empty', |
+ ' waiting: empty', |
+ ' active: ' + newer_script_url, |
+ 'statechange(activated)', |
+ ' installing: empty', |
+ ' waiting: empty', |
+ ' active: ' + newer_script_url, |
+ ]; |
+ assert_array_equals(results, expectations); |
+ return service_worker_unregister_and_done(t, scope); |
falken
2015/11/19 01:29:22
add_completion_callback instead?
nhiroki
2015/11/19 09:02:54
Done.
|
+ }); |
+ }, 'Verify registration attributes on ServiceWorkerGlobalScope of the ' + |
+ 'newer worker'); |
</script> |