| 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; | |
| 15 | 14 |
| 16 service_worker_unregister(t, scope) | 15 service_worker_unregister(t, scope) |
| 17 .then(step(function() { return with_iframe(scope); })) | 16 .then(step(function() { return with_iframe(scope); })) |
| 18 .then(step(function(f) { | 17 .then(step(function(f) { |
| 19 frame = f; | 18 frame = f; |
| 20 return navigator.serviceWorker.register(url, {scope: scope}); | 19 return navigator.serviceWorker.register(url, {scope: scope}); |
| 21 })) | 20 })) |
| 22 .then(step(function(r) { | 21 .then(step(function(registration) { |
| 23 registration = r; | |
| 24 return wait_for_update(t, registration); | |
| 25 })) | |
| 26 .then(step(function() { | |
| 27 var container = frame.contentWindow.navigator.serviceWorker; | 22 var container = frame.contentWindow.navigator.serviceWorker; |
| 28 assert_equals(container.controller, null); | 23 assert_equals(container.controller, null); |
| 29 assert_equals(registration.active, null); | 24 assert_equals(registration.active, null); |
| 30 assert_equals(registration.waiting, null); | 25 assert_equals(registration.waiting, null); |
| 31 assert_equals(registration.installing.scriptURL, normalizeURL(url)); | 26 assert_equals(registration.installing.scriptURL, normalizeURL(url)); |
| 32 | 27 |
| 33 // FIXME: Add a test for a frame created after installation. | 28 // FIXME: Add a test for a frame created after installation. |
| 34 // Should the existing frame ("frame") block activation? | 29 // Should the existing frame ("frame") block activation? |
| 35 })) | 30 })) |
| 36 .then(step(function() { | 31 .then(step(function() { |
| 37 frame.remove(); | 32 frame.remove(); |
| 38 return service_worker_unregister_and_done(t, scope); | 33 return service_worker_unregister_and_done(t, scope); |
| 39 })) | 34 })) |
| 40 .catch(unreached_rejection(t)); | 35 .catch(unreached_rejection(t)); |
| 41 }, 'installing is set'); | 36 }, 'installing is set'); |
| 42 </script> | 37 </script> |
| OLD | NEW |