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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/registration-attribute.html

Issue 1460653002: ServiceWorker: Fix messed registration attributes on ServiceWorkerGlobalScope (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
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>

Powered by Google App Engine
This is Rietveld 408576698