Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../resources/testharness.js"></script> | |
| 3 <script src="../resources/testharnessreport.js"></script> | |
| 4 <script src="resources/test-helpers.js"></script> | |
| 5 <script> | |
| 6 async_test(function(t) { | |
| 7 var documentURL = 'no-such-worker'; | |
| 8 navigator.serviceWorker.getRegistration(documentURL) | |
| 9 .then(function(value) { | |
| 10 assert_equals(value, undefined, | |
| 11 'getRegistration should resolve with undefined'); | |
| 12 t.done(); | |
| 13 }) | |
| 14 .catch(unreached_rejection(t)); | |
| 15 }, 'getRegistration'); | |
| 16 | |
| 17 async_test(function(t) { | |
| 18 var scope = 'scope/worker/'; | |
| 19 var registration; | |
| 20 navigator.serviceWorker.register('resources/empty-worker.js', | |
| 21 {scope: scope}) | |
| 22 .then(function(r) { | |
| 23 registration = r; | |
| 24 return navigator.serviceWorker.getRegistration(scope); | |
| 25 }) | |
| 26 .then(function(value) { | |
| 27 assert_equals(value, registration, | |
| 28 'getRegistration should resolve with registration'); | |
| 29 t.done(); | |
| 30 }) | |
| 31 .catch(unreached_rejection(t)); | |
| 32 }, 'Register then getRegistration'); | |
| 33 | |
|
nhiroki
2014/09/10 07:45:04
How about testing following cases?
- getRegistrat
Kunihiko Sakamoto
2014/09/10 09:34:51
Thanks for the test cases suggestion! Done.
| |
| 34 </script> | |
| OLD | NEW |