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

Side by Side Diff: LayoutTests/http/tests/serviceworker/registration-end-to-end.html

Issue 683733002: ServiceWorker: Remove the obsolete "parsed" state [3/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/http/tests/serviceworker/state.html » ('j') | 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 <title>Service Worker: registration end-to-end</title> 2 <title>Service Worker: registration end-to-end</title>
3 <script src="../resources/testharness.js"></script> 3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script> 5 <script src="resources/test-helpers.js"></script>
6 <script> 6 <script>
7 var t = async_test('Registration: end-to-end'); 7 var t = async_test('Registration: end-to-end');
8 t.step(function() { 8 t.step(function() {
9 9
10 var scope = 'resources/in-scope/'; 10 var scope = 'resources/in-scope/';
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 receivedMessageFromPort = e.data; 42 receivedMessageFromPort = e.data;
43 resolve(); 43 resolve();
44 }); 44 });
45 })); 45 }));
46 46
47 var sawActive = new Promise(t.step_func(function(resolve) { 47 var sawActive = new Promise(t.step_func(function(resolve) {
48 sw.onstatechange = t.step_func(function() { 48 sw.onstatechange = t.step_func(function() {
49 serviceWorkerStates.push(sw.state); 49 serviceWorkerStates.push(sw.state);
50 50
51 switch (sw.state) { 51 switch (sw.state) {
52 case 'installing':
53 assert_equals(lastServiceWorkerState, 'parsed');
54 break;
55 case 'installed': 52 case 'installed':
56 assert_equals(lastServiceWorkerState, 'installing'); 53 assert_equals(lastServiceWorkerState, 'installing');
57 break; 54 break;
58 case 'activating': 55 case 'activating':
59 assert_equals(lastServiceWorkerState, 'installed'); 56 assert_equals(lastServiceWorkerState, 'installed');
60 break; 57 break;
61 case 'activated': 58 case 'activated':
62 assert_equals(lastServiceWorkerState, 'activating'); 59 assert_equals(lastServiceWorkerState, 'activating');
63 break; 60 break;
64 default: 61 default:
65 // We won't see 'redundant' because onstatechange is 62 // We won't see 'redundant' because onstatechange is
66 // overwritten before calling unregister. 63 // overwritten before calling unregister.
67 assert_unreached('Unexpected state: ' + sw.state); 64 assert_unreached('Unexpected state: ' + sw.state);
68 } 65 }
69 66
70 lastServiceWorkerState = sw.state; 67 lastServiceWorkerState = sw.state;
71 if (sw.state === 'activated') 68 if (sw.state === 'activated')
72 resolve(); 69 resolve();
73 }); 70 });
74 })); 71 }));
75 72
76 Promise.all([sawMessage, sawActive]).then(t.step_func(function() { 73 Promise.all([sawMessage, sawActive]).then(t.step_func(function() {
77 assert_array_equals(serviceWorkerStates, 74 assert_array_equals(serviceWorkerStates,
78 ['parsed', 'installing', 'installed', 'activatin g', 'activated'], 75 ['installing', 'installed', 'activating', 'activ ated'],
79 'Service worker should pass through all states') ; 76 'Service worker should pass through all states') ;
80 77
81 assert_equals(currentChangeCount, 0, 78 assert_equals(currentChangeCount, 0,
82 'Should not see current changes since document is out of scope'); 79 'Should not see current changes since document is out of scope');
83 80
84 assert_equals(receivedMessageFromPort, 'Ack for: registering doc'); 81 assert_equals(receivedMessageFromPort, 'Ack for: registering doc');
85 82
86 var sawRedundant = new Promise(t.step_func(function(resolve) { 83 var sawRedundant = new Promise(t.step_func(function(resolve) {
87 sw.onstatechange = t.step_func(function() { 84 sw.onstatechange = t.step_func(function() {
88 assert_equals(sw.state, 'redundant'); 85 assert_equals(sw.state, 'redundant');
89 resolve(); 86 resolve();
90 }); 87 });
91 })); 88 }));
92 registration.unregister(); 89 registration.unregister();
93 sawRedundant.then(t.step_func(function() { 90 sawRedundant.then(t.step_func(function() {
94 t.done(); 91 t.done();
95 })); 92 }));
96 })); 93 }));
97 } 94 }
98 }); 95 });
99 </script> 96 </script>
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/http/tests/serviceworker/state.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698