Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Unified Diff: LayoutTests/http/tests/serviceworker/getregistration.html

Issue 540823003: ServiceWorker: Implement navigator.serviceWorker.getRegistration [3/3] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: patch for review Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698