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

Side by Side 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: Update the scope to match the latest test 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <script src="resources/test-helpers.js"></script> 4 <script src="resources/test-helpers.js"></script>
5 <script> 5 <script>
6 var worker_url = 'resources/empty-worker.js'; 6 var worker_url = 'resources/empty-worker.js';
7 7
8 async_test(function(t) { 8 async_test(function(t) {
9 var scope = 'resources/scope/re-register-resolves-to-new-value'; 9 var scope = 'resources/scope/re-register-resolves-to-new-value';
10 var iframe; 10 var iframe;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 .then(function(new_registration) { 50 .then(function(new_registration) {
51 assert_equals(registration, new_registration, 51 assert_equals(registration, new_registration,
52 'register should resolve to the same registration'); 52 'register should resolve to the same registration');
53 service_worker_unregister_and_done(t, scope); 53 service_worker_unregister_and_done(t, scope);
54 }) 54 })
55 .catch(unreached_rejection(t)); 55 .catch(unreached_rejection(t));
56 }, 'Unregister then register resolves to the original value if the ' + 56 }, 'Unregister then register resolves to the original value if the ' +
57 'registration is in use.'); 57 'registration is in use.');
58 58
59 async_test(function(t) { 59 async_test(function(t) {
60 var scope = 'resources/scope/complete-unregistration-followed-by-' +
61 'reloading-controllee-iframe';
62 var registration;
63 var frame;
64 var service_worker;
65 service_worker_unregister_and_register(t, worker_url, scope)
66 .then(function(r) {
67 registration = r;
68 return wait_for_state(t, r.installing, 'activated');
69 })
70 .then(function() {
71 return with_iframe(scope);
72 })
73 .then(function(f) {
74 frame = f;
75 return registration.unregister();
76 })
77 .then(function() {
78 return new Promise(function(resolve) {
79 frame.onload = resolve;
80 frame.contentWindow.location.reload();
81 });
82 })
83 .then(function() {
84 var c = frame.contentWindow.navigator.serviceWorker.controller;
85 assert_equals(c, null, 'a page after unregistration should not be ' +
86 'controlled by service worker');
87 return navigator.serviceWorker.getRegistration(scope);
88 })
89 .then(function(r) {
90 assert_equals(r, undefined, 'getRegistration should return ' +
91 'undefined after unregistration');
92 service_worker_unregister_and_done(t, scope);
93 })
94 .catch(unreached_rejection(t));
95 }, 'Reloading the last controlled iframe after unregistration should ensure ' +
96 'the deletion of the registration');
97
98 async_test(function(t) {
60 var scope = 'resources/scope/re-register-does-not-affect-existing-controllee '; 99 var scope = 'resources/scope/re-register-does-not-affect-existing-controllee ';
61 var iframe; 100 var iframe;
62 var registration; 101 var registration;
63 var controller; 102 var controller;
64 103
65 service_worker_unregister_and_register(t, worker_url, scope) 104 service_worker_unregister_and_register(t, worker_url, scope)
66 .then(function(r) { 105 .then(function(r) {
67 registration = r; 106 registration = r;
68 return wait_for_state(t, r.installing, 'activated'); 107 return wait_for_state(t, r.installing, 'activated');
69 }) 108 })
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // FIXME: When crbug.com/400602 is fixed, assert that controller 158 // FIXME: When crbug.com/400602 is fixed, assert that controller
120 // equals the original worker. 159 // equals the original worker.
121 assert_not_equals( 160 assert_not_equals(
122 frame.contentWindow.navigator.serviceWorker.controller, null, 161 frame.contentWindow.navigator.serviceWorker.controller, null,
123 'document should have a controller'); 162 'document should have a controller');
124 service_worker_unregister_and_done(t, scope); 163 service_worker_unregister_and_done(t, scope);
125 }) 164 })
126 .catch(unreached_rejection(t)); 165 .catch(unreached_rejection(t));
127 }, 'Unregister then register resurrects the registration'); 166 }, 'Unregister then register resurrects the registration');
128 </script> 167 </script>
OLDNEW
« 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