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 = 'resources/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}); |
22 return register_promise1; | 22 return register_promise1; |
23 }) | 23 }) |
24 .then(function(r) { | 24 .then(function(r) { |
25 registration = r; | 25 registration = r; |
26 return wait_for_update(t, registration); | |
27 }) | |
28 .then(function() { | |
29 assert_equals(registration.installing.scriptURL, script1, | 26 assert_equals(registration.installing.scriptURL, script1, |
30 'on first update, first script should be installing'); | 27 'on first update, first script should be installing'); |
31 assert_equals(registration.waiting, null, | 28 assert_equals(registration.waiting, null, |
32 'on first update, waiting should be null'); | 29 'on first update, waiting should be null'); |
33 assert_equals(registration.active, null, | 30 assert_equals(registration.active, null, |
34 'on first update, active should be null'); | 31 'on first update, active should be null'); |
35 return register_promise2; | 32 return register_promise2; |
36 }) | 33 }) |
37 .then(function(r) { | 34 .then(function(r) { |
38 assert_equals(r, registration); | 35 assert_equals(r, registration); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 'the new version should control a new doc'); | 242 'the new version should control a new doc'); |
246 unload_iframe(frame); | 243 unload_iframe(frame); |
247 return registration.unregister(); | 244 return registration.unregister(); |
248 }) | 245 }) |
249 .then(function() { | 246 .then(function() { |
250 t.done(); | 247 t.done(); |
251 }) | 248 }) |
252 .catch(unreached_rejection(t)); | 249 .catch(unreached_rejection(t)); |
253 }, 'Register same-scope new script url effect on controller'); | 250 }, 'Register same-scope new script url effect on controller'); |
254 </script> | 251 </script> |
OLD | NEW |