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