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 10 matching lines...) Expand all Loading... |
21 navigator.serviceWorker.register('resources/empty-worker.js', | 21 navigator.serviceWorker.register('resources/empty-worker.js', |
22 {scope: scope}) | 22 {scope: scope}) |
23 .then(function(r) { | 23 .then(function(r) { |
24 registration = r; | 24 registration = r; |
25 return registration.unregister(); | 25 return registration.unregister(); |
26 }) | 26 }) |
27 .then(function() { | 27 .then(function() { |
28 return registration.unregister(); | 28 return registration.unregister(); |
29 }) | 29 }) |
30 .then(function(value) { | 30 .then(function(value) { |
31 // FIXME: This value must be false in spec, | 31 // FIXME: Uncomment after applied the first patch. |
32 // but this is not supported now. | 32 // https://codereview.chromium.org/554573002 |
33 // See: https://crbug.com/390894#c16 | 33 // See: https://crbug.com/390894#c16 |
34 assert_equals(value, true, | 34 // assert_equals(value, false, |
35 'unregistering twice should resolve with true'); | 35 // 'unregistering twice should resolve with false'); |
36 t.done(); | 36 t.done(); |
37 }) | 37 }) |
38 .catch(unreached_rejection(t)); | 38 .catch(unreached_rejection(t)); |
39 }, 'Unregister twice'); | 39 }, 'Unregister twice'); |
40 | 40 |
41 async_test(function(t) { | 41 async_test(function(t) { |
42 var scope = 'scope/successful-unregister/'; | 42 var scope = 'scope/successful-unregister/'; |
43 navigator.serviceWorker.register('resources/empty-worker.js', | 43 navigator.serviceWorker.register('resources/empty-worker.js', |
44 {scope: scope}) | 44 {scope: scope}) |
45 .then(function(registration) { | 45 .then(function(registration) { |
(...skipping 28 matching lines...) Expand all Loading... |
74 }) | 74 }) |
75 .then(function(state) { | 75 .then(function(state) { |
76 assert_equals(state, 'redundant', | 76 assert_equals(state, 'redundant', |
77 'service worker registered with default scope ' + | 77 'service worker registered with default scope ' + |
78 'should be unregistered'); | 78 'should be unregistered'); |
79 t.done(); | 79 t.done(); |
80 }) | 80 }) |
81 .catch(unreached_rejection(t)); | 81 .catch(unreached_rejection(t)); |
82 }, 'ServiceWorkerContainer.unregister() with default scope'); | 82 }, 'ServiceWorkerContainer.unregister() with default scope'); |
83 </script> | 83 </script> |
OLD | NEW |