| 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 var documentURL = 'no-such-worker'; | 7 var documentURL = 'no-such-worker'; |
| 8 navigator.serviceWorker.getRegistration(documentURL) | 8 navigator.serviceWorker.getRegistration(documentURL) |
| 9 .then(function(value) { | 9 .then(function(value) { |
| 10 assert_equals(value, undefined, | 10 assert_equals(value, undefined, |
| 11 'getRegistration should resolve with undefined'); | 11 'getRegistration should resolve with undefined'); |
| 12 t.done(); | 12 t.done(); |
| 13 }) | 13 }) |
| 14 .catch(unreached_rejection(t)); | 14 .catch(unreached_rejection(t)); |
| 15 }, 'getRegistration'); | 15 }, 'getRegistration'); |
| 16 | 16 |
| 17 async_test(function(t) { | 17 async_test(function(t) { |
| 18 var scope = 'scope/worker/'; | 18 var scope = 'resources/scope/worker/'; |
| 19 var registration; | 19 var registration; |
| 20 service_worker_unregister_and_register(t, 'resources/empty-worker.js', | 20 service_worker_unregister_and_register(t, 'resources/empty-worker.js', |
| 21 scope) | 21 scope) |
| 22 .then(function(r) { | 22 .then(function(r) { |
| 23 registration = r; | 23 registration = r; |
| 24 return navigator.serviceWorker.getRegistration(scope); | 24 return navigator.serviceWorker.getRegistration(scope); |
| 25 }) | 25 }) |
| 26 .then(function(value) { | 26 .then(function(value) { |
| 27 assert_equals(value, registration, | 27 assert_equals(value, registration, |
| 28 'getRegistration should resolve with registration'); | 28 'getRegistration should resolve with registration'); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 40 }, function(reason) { | 40 }, function(reason) { |
| 41 assert_equals( | 41 assert_equals( |
| 42 reason.name, 'SecurityError', | 42 reason.name, 'SecurityError', |
| 43 'getRegistration with an out of origin URL should fail'); | 43 'getRegistration with an out of origin URL should fail'); |
| 44 t.done(); | 44 t.done(); |
| 45 }) | 45 }) |
| 46 .catch(unreached_rejection(t)); | 46 .catch(unreached_rejection(t)); |
| 47 }, 'getRegistration with a cross origin URL'); | 47 }, 'getRegistration with a cross origin URL'); |
| 48 | 48 |
| 49 async_test(function(t) { | 49 async_test(function(t) { |
| 50 var scope = 'scope/worker/'; | 50 var scope = 'resources/scope/worker/'; |
| 51 service_worker_unregister_and_register(t, 'resources/empty-worker.js', | 51 service_worker_unregister_and_register(t, 'resources/empty-worker.js', |
| 52 scope) | 52 scope) |
| 53 .then(function(registration) { | 53 .then(function(registration) { |
| 54 return registration.unregister(); | 54 return registration.unregister(); |
| 55 }) | 55 }) |
| 56 .then(function() { | 56 .then(function() { |
| 57 return navigator.serviceWorker.getRegistration(scope); | 57 return navigator.serviceWorker.getRegistration(scope); |
| 58 }) | 58 }) |
| 59 .then(function(value) { | 59 .then(function(value) { |
| 60 assert_equals(value, undefined, | 60 assert_equals(value, undefined, |
| 61 'getRegistration should resolve with undefined'); | 61 'getRegistration should resolve with undefined'); |
| 62 t.done(); | 62 t.done(); |
| 63 }) | 63 }) |
| 64 .catch(unreached_rejection(t)); | 64 .catch(unreached_rejection(t)); |
| 65 }, 'Register then Unregister then getRegistration'); | 65 }, 'Register then Unregister then getRegistration'); |
| 66 | 66 |
| 67 </script> | 67 </script> |
| OLD | NEW |