| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>ServiceWorker: navigator.serviceWorker.installing</title> | 2 <title>ServiceWorker: navigator.serviceWorker.installing</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 <body> | 6 <body> |
| 7 <script> | 7 <script> |
| 8 // "installing" is set | 8 // "installing" is set |
| 9 async_test(function(t) { | 9 async_test(function(t) { |
| 10 var step = t.step_func.bind(t); | 10 var step = t.step_func.bind(t); |
| 11 var url = 'resources/empty-worker.js'; | 11 var url = 'resources/empty-worker.js'; |
| 12 var scope = 'resources/blank.html'; | 12 var scope = 'resources/blank.html'; |
| 13 var frame; | 13 var frame; |
| 14 var registration; | 14 var registration; |
| 15 | 15 |
| 16 navigator.serviceWorker.unregister(scope) | 16 navigator.serviceWorker.unregister(scope) |
| 17 .then(step(function() { return with_iframe(scope); }), | 17 .then(step(function() { return with_iframe(scope); }), |
| 18 unreached_rejection(t, 'Unregister should not fail')) | 18 unreached_rejection(t, 'Unregister should not fail')) |
| 19 .then(step(function(f) { | 19 .then(step(function(f) { |
| 20 frame = f; | 20 frame = f; |
| 21 return navigator.serviceWorker.register(url, {scope: scope}); | 21 return navigator.serviceWorker.register(url, {scope: scope}); |
| 22 })) | 22 })) |
| 23 .then(step(function(r) { | 23 .then(step(function(r) { |
| 24 registration = r; | 24 registration = r; |
| 25 return wait_for_update(t, registration); | 25 return wait_for_update(t, registration); |
| 26 })) | 26 })) |
| 27 .then(step(function(serviceWorker) { | |
| 28 return wait_for_state(t, serviceWorker, 'installing'); | |
| 29 }), unreached_rejection(t, 'Registration should not fail')) | |
| 30 .then(step(function() { | 27 .then(step(function() { |
| 31 var container = frame.contentWindow.navigator.serviceWorker; | 28 var container = frame.contentWindow.navigator.serviceWorker; |
| 32 assert_equals(container.controller, null); | 29 assert_equals(container.controller, null); |
| 33 assert_equals(registration.active, null); | 30 assert_equals(registration.active, null); |
| 34 assert_equals(registration.waiting, null); | 31 assert_equals(registration.waiting, null); |
| 35 assert_equals(registration.installing.scriptURL, normalizeURL(url)); | 32 assert_equals(registration.installing.scriptURL, normalizeURL(url)); |
| 36 | 33 |
| 37 // FIXME: Add a test for a frame created after installation. | 34 // FIXME: Add a test for a frame created after installation. |
| 38 // Should the existing frame ("frame") block activation? | 35 // Should the existing frame ("frame") block activation? |
| 39 })) | 36 })) |
| 40 .then(step(function() { | 37 .then(step(function() { |
| 41 frame.remove(); | 38 frame.remove(); |
| 42 return service_worker_unregister_and_done(t, scope); | 39 return service_worker_unregister_and_done(t, scope); |
| 43 })); | 40 })); |
| 44 }, 'installing is set'); | 41 }, 'installing is set'); |
| 45 </script> | 42 </script> |
| OLD | NEW |