diff options
Diffstat (limited to 'test/wpt/tests/service-workers/service-worker/registration-basic.https.html')
-rw-r--r-- | test/wpt/tests/service-workers/service-worker/registration-basic.https.html | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/wpt/tests/service-workers/service-worker/registration-basic.https.html b/test/wpt/tests/service-workers/service-worker/registration-basic.https.html new file mode 100644 index 0000000..759b424 --- /dev/null +++ b/test/wpt/tests/service-workers/service-worker/registration-basic.https.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<title>Service Worker: Registration (basic)</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/test-helpers.sub.js"></script> +<script> +const script = 'resources/registration-worker.js'; + +promise_test(async (t) => { + const scope = 'resources/registration/normal'; + const registration = await navigator.serviceWorker.register(script, {scope}); + t.add_cleanup(() => registration.unregister()); + assert_true( + registration instanceof ServiceWorkerRegistration, + 'Successfully registered.'); +}, 'Registering normal scope'); + +promise_test(async (t) => { + const scope = 'resources/registration/scope-with-fragment#ref'; + const registration = await navigator.serviceWorker.register(script, {scope}); + t.add_cleanup(() => registration.unregister()); + assert_true( + registration instanceof ServiceWorkerRegistration, + 'Successfully registered.'); + assert_equals( + registration.scope, + normalizeURL('resources/registration/scope-with-fragment'), + 'A fragment should be removed from scope'); +}, 'Registering scope with fragment'); + +promise_test(async (t) => { + const scope = 'resources/'; + const registration = await navigator.serviceWorker.register(script, {scope}) + t.add_cleanup(() => registration.unregister()); + assert_true( + registration instanceof ServiceWorkerRegistration, + 'Successfully registered.'); +}, 'Registering same scope as the script directory'); +</script> |