Chromium Code Reviews| 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> | 5 <script> |
| 5 (function() { | 6 (function() { |
| 6 var t = async_test('Unregistering out of origin'); | 7 var t = async_test('Unregistering out of origin'); |
| 7 navigator.serviceWorker.unregister('http://example.com/*').then( | 8 navigator.serviceWorker.unregister('http://example.com/*').then( |
| 8 t.step_func(function() { | 9 t.step_func(function() { |
| 9 assert_unreached('unregistering out of origin should fail'); | 10 assert_unreached('unregistering out of origin should fail'); |
| 10 }), | 11 }), |
| 11 t.step_func(function(reason) { | 12 t.step_func(function(reason) { |
| 12 assert_equals(reason.name, 'SecurityError', | 13 assert_equals(reason.name, 'SecurityError', |
| 13 'unregistering out of origins should fail'); | 14 'unregistering out of origins should fail'); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 assert_equals(value, undefined, | 50 assert_equals(value, undefined, |
| 50 'successful unregistration should succeed ' + | 51 'successful unregistration should succeed ' + |
| 51 'with no value'); | 52 'with no value'); |
| 52 t.done(); | 53 t.done(); |
| 53 }, | 54 }, |
| 54 t.step_func(function(reason) { | 55 t.step_func(function(reason) { |
| 55 assert_unreached('unregistration should succeed.'); | 56 assert_unreached('unregistration should succeed.'); |
| 56 }) | 57 }) |
| 57 ); | 58 ); |
| 58 }()); | 59 }()); |
| 60 | |
| 61 async_test(function(t) { | |
| 62 var statePromise; | |
|
dominicc (has gone to gerrit)
2014/07/10 06:19:37
state_promise
| |
| 63 service_worker_unregister_and_register(t, 'resources/empty-worker.js'). | |
|
dominicc (has gone to gerrit)
2014/07/10 06:19:37
Break before .
| |
| 64 then(t.step_func(function(sw) { | |
| 65 // FIXME; 'deactivated' should be 'redundant' crrev.com/352423005 | |
|
dominicc (has gone to gerrit)
2014/07/03 04:44:35
FIXME; -> FIXME:
dominicc (has gone to gerrit)
2014/07/03 04:44:35
You could map redundant to deactivated inside wait
jsbell
2014/07/03 05:16:13
The CL to rename the states will land before this
| |
| 66 statePromise = wait_for_state(t, sw, 'deactivated'); | |
| 67 return navigator.serviceWorker.unregister(); | |
| 68 })). | |
| 69 then(t.step_func(function(value) { | |
| 70 assert_equals(value, undefined, | |
| 71 'unregister with default scope should succeed'); | |
| 72 return statePromise; | |
| 73 })). | |
| 74 then(t.step_func(function(state) { | |
| 75 // FIXME; 'deactivated' should be 'redundant' crrev.com/352423005 | |
| 76 assert_equals(state, 'deactivated', | |
| 77 'service worker registered with default scope ' + | |
| 78 'should be unregstered'); | |
| 79 t.done(); | |
| 80 })). | |
| 81 catch(unreached_rejection(t)); | |
| 82 | |
| 83 }, 'Unregistering with default scope'); | |
| 59 </script> | 84 </script> |
| OLD | NEW |