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

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: Change the test to check if the registration gets null/undefined 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/re-register-after-reloading-iframe-' +
61 'with-old-registration-in-use';
62 var old_registration;
63 var new_registration;
nhiroki 2016/04/11 09:51:36 unused
shimazu (google) 2016/04/12 03:42:30 Done.
64 var frame;
65 var service_worker;
nhiroki 2016/04/11 09:51:36 unused
shimazu (google) 2016/04/12 03:42:30 Done.
66 service_worker_unregister_and_register(t, worker_url, scope)
67 .then(function(r) {
68 old_registration = r;
69 return wait_for_state(t, r.installing, 'activated');
70 })
71 .then(function() {
72 return with_iframe(scope);
73 })
74 .then(function(f) {
75 frame = f;
76 return old_registration.unregister();
77 })
78 .then(function() {
79 return new Promise(function(resolve) {
80 frame.onload = resolve;
81 frame.contentWindow.location.reload();
82 });
83 })
84 .then(function() {
85 var c = frame.contentWindow.navigator.serviceWorker.controller;
86 assert_equals(c, null, 'a page after unregistration should not be ' +
87 'provided from service worker');
nhiroki 2016/04/11 09:51:36 "controlled by" would be more common phrase than "
shimazu (google) 2016/04/12 03:42:30 Done.
88 return navigator.serviceWorker.getRegistration(scope);
89 })
90 .then(function(r) {
91 assert_equals(r, undefined, 'getRegistration should return ' +
92 'undefined after unregistration');
93 service_worker_unregister_and_done(t, scope);
94 })
95 .catch(unreached_rejection(t));
96 }, 'Unregistration followed by reloading the iframe provided by a ' +
97 'service worker should unregister the service worker successfully');
nhiroki 2016/04/11 09:51:36 I think the main action of this test is 'reloading
shimazu (google) 2016/04/12 03:42:30 Done.
98
99 async_test(function(t) {
60 var scope = 'resources/scope/re-register-does-not-affect-existing-controllee '; 100 var scope = 'resources/scope/re-register-does-not-affect-existing-controllee ';
61 var iframe; 101 var iframe;
62 var registration; 102 var registration;
63 var controller; 103 var controller;
64 104
65 service_worker_unregister_and_register(t, worker_url, scope) 105 service_worker_unregister_and_register(t, worker_url, scope)
66 .then(function(r) { 106 .then(function(r) {
67 registration = r; 107 registration = r;
68 return wait_for_state(t, r.installing, 'activated'); 108 return wait_for_state(t, r.installing, 'activated');
69 }) 109 })
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // FIXME: When crbug.com/400602 is fixed, assert that controller 159 // FIXME: When crbug.com/400602 is fixed, assert that controller
120 // equals the original worker. 160 // equals the original worker.
121 assert_not_equals( 161 assert_not_equals(
122 frame.contentWindow.navigator.serviceWorker.controller, null, 162 frame.contentWindow.navigator.serviceWorker.controller, null,
123 'document should have a controller'); 163 'document should have a controller');
124 service_worker_unregister_and_done(t, scope); 164 service_worker_unregister_and_done(t, scope);
125 }) 165 })
126 .catch(unreached_rejection(t)); 166 .catch(unreached_rejection(t));
127 }, 'Unregister then register resurrects the registration'); 167 }, 'Unregister then register resurrects the registration');
128 </script> 168 </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