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

Side by Side Diff: content/test/data/service_worker/imports_bust_memcache.html

Issue 579183002: Migrate browsertest to use ServiceWorkerRegistration.unregister() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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> 2 <script>
3 // See ServiceWorkerBrowserTest ImportsBustMemcache. 3 // See ServiceWorkerBrowserTest ImportsBustMemcache.
4 // Content-Shell data persists so unregister first to clear old data. 4 // Content-Shell data persists so unregister first to clear old data.
5 // Register, unregister, then reregister. The browsertest examines the 5 // Register, unregister, then reregister. The browsertest examines the
6 // state of the scriptcache to ensure the script and import are cached. 6 // state of the scriptcache to ensure the script and import are cached.
7 7
8 var scope = 'imports_bust_memcache_scope/'; 8 var scope = 'imports_bust_memcache_scope/';
9 var script = 'worker_with_one_import.js'; 9 var script = 'worker_with_one_import.js';
10 10
11 navigator.serviceWorker.unregister(scope) 11 navigator.serviceWorker.getRegistration(scope)
12 .then(function(registration) {
13 if (registration)
14 return registration.unregister();
15 })
12 .then(function(_) { 16 .then(function(_) {
13 console.log('initial unregistration done'); 17 console.log('initial unregistration done');
14 return navigator.serviceWorker.register(script, {scope: scope}); 18 return navigator.serviceWorker.register(script, {scope: scope});
15 }) 19 })
16 .then(function(_) { 20 .then(function(registration) {
17 console.log('initial registration done'); 21 console.log('initial registration done');
18 return navigator.serviceWorker.unregister(scope); 22 return registration.unregister();
19 }) 23 })
20 .then(function(_) { 24 .then(function(_) {
21 console.log('unregistration done'); 25 console.log('unregistration done');
22 return navigator.serviceWorker.register(script, {scope: scope}); 26 return navigator.serviceWorker.register(script, {scope: scope});
23 }) 27 })
24 .then(function(_) { 28 .then(function(_) {
25 console.log('second registration done'); 29 console.log('second registration done');
26 document.title = 'OK'; // Titlewatcher looks for this. 30 document.title = 'OK'; // Titlewatcher looks for this.
27 }) 31 })
28 .catch(function(e) { 32 .catch(function(e) {
29 document.title = 'FAILED'; 33 document.title = 'FAILED';
30 }); 34 });
31 </script> 35 </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