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

Side by Side Diff: LayoutTests/http/tests/serviceworker/service-worker-gc.html

Issue 352423005: Add ServiceWorker InstallPhaseEvent.waitUntil() layout test. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: review update Created 6 years, 5 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="/js-test-resources/js-test.js"></script> 2 <script src="/js-test-resources/js-test.js"></script>
3 <body> 3 <body>
4 <script> 4 <script>
5 window.jsTestIsAsync = true; 5 window.jsTestIsAsync = true;
6 description('Test that a registered Service Worker with an event handler is not garbage collected prematurely'); 6 description('Test that a registered Service Worker with an event handler is not garbage collected prematurely');
7 swObservation = null; 7 swObservation = null;
8 scope = 'gc'; 8 scope = 'gc';
9 9
10 if (!window.internals) { 10 if (!window.internals) {
(...skipping 24 matching lines...) Expand all
35 35
36 function onRegister(sw) { 36 function onRegister(sw) {
37 swObservation = internals.observeGC(sw); 37 swObservation = internals.observeGC(sw);
38 sw.addEventListener('statechange', onStateChange); 38 sw.addEventListener('statechange', onStateChange);
39 setTimeout(assertServiceWorkerIsNotCollected, 0); 39 setTimeout(assertServiceWorkerIsNotCollected, 0);
40 } 40 }
41 41
42 function onStateChange(event) { 42 function onStateChange(event) {
43 assertServiceWorkerIsNotCollected(); 43 assertServiceWorkerIsNotCollected();
44 44
45 if (event.target.state != 'active') 45 if (event.target.state != 'activated')
46 return; 46 return;
47 navigator.serviceWorker.unregister(scope).then(onUnregister); 47 navigator.serviceWorker.unregister(scope).then(onUnregister);
48 } 48 }
49 49
50 function onUnregister() 50 function onUnregister()
51 { 51 {
52 // FIXME: Assert that the ServiceWorker *is* collected when the 'redundant' state is implemented. 52 // FIXME: Assert that the ServiceWorker *is* collected when the 'redundant' state is implemented.
53 assertServiceWorkerIsNotCollected(); 53 assertServiceWorkerIsNotCollected();
54 54
55 finishJSTest(); 55 finishJSTest();
56 } 56 }
57 </script> 57 </script>
58 </body> 58 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698