OLD | NEW |
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 script1 = normalizeURL('resources/empty-worker.js'); | 6 var script1 = normalizeURL('resources/empty-worker.js'); |
7 var script2 = normalizeURL('resources/empty-worker.js?new'); | 7 var script2 = normalizeURL('resources/empty-worker.js?new'); |
8 | 8 |
9 // FIXME: The spec is in flux, this test's asserts may not be as per-spec. | 9 // FIXME: The spec is in flux, this test's asserts may not be as per-spec. |
10 async_test(function(t) { | 10 async_test(function(t) { |
11 var scope = 'scope/register-new-script-concurrently'; | 11 var scope = 'resources/scope/register-new-script-concurrently'; |
12 var registration; | 12 var registration; |
13 var register_promise1; | 13 var register_promise1; |
14 var register_promise2; | 14 var register_promise2; |
15 | 15 |
16 service_worker_unregister(t, scope) | 16 service_worker_unregister(t, scope) |
17 .then(function() { | 17 .then(function() { |
18 register_promise1 = navigator.serviceWorker.register(script1, | 18 register_promise1 = navigator.serviceWorker.register(script1, |
19 {scope: scope}); | 19 {scope: scope}); |
20 register_promise2 = navigator.serviceWorker.register(script2, | 20 register_promise2 = navigator.serviceWorker.register(script2, |
21 {scope: scope}); | 21 {scope: scope}); |
(...skipping 25 matching lines...) Expand all Loading... |
47 'on second update, first script should be active'); | 47 'on second update, first script should be active'); |
48 return registration.unregister(); | 48 return registration.unregister(); |
49 }) | 49 }) |
50 .then(function() { | 50 .then(function() { |
51 t.done(); | 51 t.done(); |
52 }) | 52 }) |
53 .catch(unreached_rejection(t)); | 53 .catch(unreached_rejection(t)); |
54 }, 'Register different scripts concurrently'); | 54 }, 'Register different scripts concurrently'); |
55 | 55 |
56 async_test(function(t) { | 56 async_test(function(t) { |
57 var scope = 'scope/register-then-register-new-script'; | 57 var scope = 'resources/scope/register-then-register-new-script'; |
58 var registration; | 58 var registration; |
59 | 59 |
60 service_worker_unregister_and_register(t, script1, scope) | 60 service_worker_unregister_and_register(t, script1, scope) |
61 .then(function(r) { | 61 .then(function(r) { |
62 registration = r; | 62 registration = r; |
63 return wait_for_update(t, registration); | 63 return wait_for_update(t, registration); |
64 }) | 64 }) |
65 .then(function() { | 65 .then(function() { |
66 return wait_for_state(t, registration.installing, 'activated'); | 66 return wait_for_state(t, registration.installing, 'activated'); |
67 }) | 67 }) |
(...skipping 29 matching lines...) Expand all Loading... |
97 'on installed, the first script should be active'); | 97 'on installed, the first script should be active'); |
98 return registration.unregister(); | 98 return registration.unregister(); |
99 }) | 99 }) |
100 .then(function() { | 100 .then(function() { |
101 t.done(); | 101 t.done(); |
102 }) | 102 }) |
103 .catch(unreached_rejection(t)); | 103 .catch(unreached_rejection(t)); |
104 }, 'Register then register new script URL'); | 104 }, 'Register then register new script URL'); |
105 | 105 |
106 async_test(function(t) { | 106 async_test(function(t) { |
107 var scope = 'scope/register-then-register-new-script-404'; | 107 var scope = 'resources/scope/register-then-register-new-script-404'; |
108 var registration; | 108 var registration; |
109 | 109 |
110 service_worker_unregister_and_register(t, script1, scope) | 110 service_worker_unregister_and_register(t, script1, scope) |
111 .then(function(r) { | 111 .then(function(r) { |
112 registration = r; | 112 registration = r; |
113 return wait_for_update(t, registration); | 113 return wait_for_update(t, registration); |
114 }) | 114 }) |
115 .then(function() { | 115 .then(function() { |
116 return wait_for_state(t, registration.installing, 'activated'); | 116 return wait_for_state(t, registration.installing, 'activated'); |
117 }) | 117 }) |
(...skipping 18 matching lines...) Expand all Loading... |
136 'on rejected, the first script should be active'); | 136 'on rejected, the first script should be active'); |
137 return registration.unregister(); | 137 return registration.unregister(); |
138 }) | 138 }) |
139 .then(function() { | 139 .then(function() { |
140 t.done(); | 140 t.done(); |
141 }) | 141 }) |
142 .catch(unreached_rejection(t)); | 142 .catch(unreached_rejection(t)); |
143 }, 'Register then register new script URL that 404s'); | 143 }, 'Register then register new script URL that 404s'); |
144 | 144 |
145 async_test(function(t) { | 145 async_test(function(t) { |
146 var scope = 'scope/register-then-register-new-script-reject-install'; | 146 var scope = 'resources/scope/register-then-register-new-script-reject-instal
l'; |
147 var reject_script = normalizeURL('resources/reject-install-worker.js'); | 147 var reject_script = normalizeURL('resources/reject-install-worker.js'); |
148 var registration; | 148 var registration; |
149 | 149 |
150 service_worker_unregister_and_register(t, script1, scope) | 150 service_worker_unregister_and_register(t, script1, scope) |
151 .then(function(r) { | 151 .then(function(r) { |
152 registration = r; | 152 registration = r; |
153 return wait_for_update(t, registration); | 153 return wait_for_update(t, registration); |
154 }) | 154 }) |
155 .then(function() { | 155 .then(function() { |
156 return wait_for_state(t, registration.installing, 'activated'); | 156 return wait_for_state(t, registration.installing, 'activated'); |
(...skipping 30 matching lines...) Expand all Loading... |
187 'on redundant, the first script should be active'); | 187 'on redundant, the first script should be active'); |
188 return registration.unregister(); | 188 return registration.unregister(); |
189 }) | 189 }) |
190 .then(function() { | 190 .then(function() { |
191 t.done(); | 191 t.done(); |
192 }) | 192 }) |
193 .catch(unreached_rejection(t)); | 193 .catch(unreached_rejection(t)); |
194 }, 'Register then register new script that does not install'); | 194 }, 'Register then register new script that does not install'); |
195 | 195 |
196 async_test(function(t) { | 196 async_test(function(t) { |
197 var scope = 'scope/register-new-script-controller'; | 197 var scope = 'resources/scope/register-new-script-controller'; |
198 var iframe; | 198 var iframe; |
199 var registration; | 199 var registration; |
200 | 200 |
201 service_worker_unregister_and_register(t, script1, scope) | 201 service_worker_unregister_and_register(t, script1, scope) |
202 .then(function(r) { | 202 .then(function(r) { |
203 registration = r; | 203 registration = r; |
204 return wait_for_update(t, registration); | 204 return wait_for_update(t, registration); |
205 }) | 205 }) |
206 .then(function() { | 206 .then(function() { |
207 return wait_for_state(t, registration.installing, 'activated'); | 207 return wait_for_state(t, registration.installing, 'activated'); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 'the new version should control a new doc'); | 245 'the new version should control a new doc'); |
246 unload_iframe(frame); | 246 unload_iframe(frame); |
247 return registration.unregister(); | 247 return registration.unregister(); |
248 }) | 248 }) |
249 .then(function() { | 249 .then(function() { |
250 t.done(); | 250 t.done(); |
251 }) | 251 }) |
252 .catch(unreached_rejection(t)); | 252 .catch(unreached_rejection(t)); |
253 }, 'Register same-scope new script url effect on controller'); | 253 }, 'Register same-scope new script url effect on controller'); |
254 </script> | 254 </script> |
OLD | NEW |