Chromium Code Reviews| Index: LayoutTests/http/tests/serviceworker/getregistration.html |
| diff --git a/LayoutTests/http/tests/serviceworker/getregistration.html b/LayoutTests/http/tests/serviceworker/getregistration.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f193dacf030480cf67ed500afe033eaa3d6c17e4 |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/serviceworker/getregistration.html |
| @@ -0,0 +1,34 @@ |
| +<!DOCTYPE html> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="resources/test-helpers.js"></script> |
| +<script> |
| +async_test(function(t) { |
| + var documentURL = 'no-such-worker'; |
| + navigator.serviceWorker.getRegistration(documentURL) |
| + .then(function(value) { |
| + assert_equals(value, undefined, |
| + 'getRegistration should resolve with undefined'); |
| + t.done(); |
| + }) |
| + .catch(unreached_rejection(t)); |
| + }, 'getRegistration'); |
| + |
| +async_test(function(t) { |
| + var scope = 'scope/worker/'; |
| + var registration; |
| + navigator.serviceWorker.register('resources/empty-worker.js', |
| + {scope: scope}) |
| + .then(function(r) { |
| + registration = r; |
| + return navigator.serviceWorker.getRegistration(scope); |
| + }) |
| + .then(function(value) { |
| + assert_equals(value, registration, |
| + 'getRegistration should resolve with registration'); |
| + t.done(); |
| + }) |
| + .catch(unreached_rejection(t)); |
| + }, 'Register then getRegistration'); |
| + |
|
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.
|
| +</script> |