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 async_test(function(t) { | 6 async_test(function(t) { |
7 navigator.serviceWorker.unregister('http://example.com/') | 7 navigator.serviceWorker.unregister('http://example.com/') |
8 .then(function() { | 8 .then(function() { |
9 assert_unreached('unregistering out of origin should fail'); | 9 assert_unreached('unregistering out of origin should fail'); |
10 }, function(reason) { | 10 }, function(reason) { |
(...skipping 26 matching lines...) Expand all Loading... |
37 assert_equals(value, undefined, | 37 assert_equals(value, undefined, |
38 'successful unregistration should succeed with no value'); | 38 'successful unregistration should succeed with no value'); |
39 t.done(); | 39 t.done(); |
40 }) | 40 }) |
41 .catch(unreached_rejection(t)); | 41 .catch(unreached_rejection(t)); |
42 }, 'Register then unregister'); | 42 }, 'Register then unregister'); |
43 | 43 |
44 async_test(function(t) { | 44 async_test(function(t) { |
45 var state_promise; | 45 var state_promise; |
46 service_worker_unregister_and_register(t, 'resources/empty-worker.js') | 46 service_worker_unregister_and_register(t, 'resources/empty-worker.js') |
| 47 .then(function(registration) { |
| 48 return wait_for_update(t, registration); |
| 49 }) |
47 .then(function(sw) { | 50 .then(function(sw) { |
48 state_promise = wait_for_state(t, sw, 'redundant'); | 51 state_promise = wait_for_state(t, sw, 'redundant'); |
49 return navigator.serviceWorker.unregister(); | 52 return navigator.serviceWorker.unregister(); |
50 }) | 53 }) |
51 .then(function(value) { | 54 .then(function(value) { |
52 assert_equals(value, undefined, | 55 assert_equals(value, undefined, |
53 'unregister with default scope should succeed'); | 56 'unregister with default scope should succeed'); |
54 return state_promise; | 57 return state_promise; |
55 }) | 58 }) |
56 .then(function(state) { | 59 .then(function(state) { |
57 assert_equals(state, 'redundant', | 60 assert_equals(state, 'redundant', |
58 'service worker registered with default scope should be ' + | 61 'service worker registered with default scope should be ' + |
59 'unregstered'); | 62 'unregstered'); |
60 t.done(); | 63 t.done(); |
61 }) | 64 }) |
62 .catch(unreached_rejection(t)); | 65 .catch(unreached_rejection(t)); |
63 }, 'Unregistering with default scope'); | 66 }, 'Unregistering with default scope'); |
64 | 67 |
65 </script> | 68 </script> |
OLD | NEW |