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

Unified Diff: LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/registration-attribute-worker.js

Issue 822593003: ServiceWorker: Expose registration within ServiceWorkerGlobalScope [3/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@expose_swreg
Patch Set: address review comments Created 5 years, 11 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/ServiceWorkerGlobalScope/resources/registration-attribute-worker.js
diff --git a/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/registration-attribute-worker.js b/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/registration-attribute-worker.js
new file mode 100644
index 0000000000000000000000000000000000000000..236a27891506f4b661a1d50c5de539bc285a4fbb
--- /dev/null
+++ b/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/registration-attribute-worker.js
@@ -0,0 +1,53 @@
+importScripts('../../resources/test-helpers.js');
+importScripts('../../resources/worker-testharness.js');
+
+assert_equals(
+ self.registration.scope,
+ normalizeURL('scope/registration-attribute'),
+ 'On worker script evaluation, registration attribute should be set');
+assert_equals(
+ self.registration.installing,
+ null,
+ 'On worker script evaluation, installing worker should be null');
+assert_equals(
+ self.registration.waiting,
+ null,
+ 'On worker script evaluation, waiting worker should be null');
+assert_equals(
+ self.registration.active,
+ null,
+ 'On worker script evaluation, active worker should be null');
+
+self.addEventListener('install', function(e) {
+ assert_equals(
+ self.registration.scope,
+ normalizeURL('scope/registration-attribute'),
+ 'On install event, registration attribute should be set');
+ // FIXME: Verify that...
+ // - registration.installing is set.
+ // - registration.{waiting, active} are null.
+ // (http://crbug.com/437677)
+ });
+
+self.addEventListener('activate', function(e) {
+ assert_equals(
+ self.registration.scope,
+ normalizeURL('scope/registration-attribute'),
+ 'On activate event, registration attribute should be set');
+ // FIXME: Verify that...
+ // - registration.{installing, waiting} are null.
+ // - registration.active is set.
+ // (http://crbug.com/437677)
+ });
+
+self.addEventListener('fetch', function(e) {
+ assert_equals(
+ self.registration.scope,
+ normalizeURL('scope/registration-attribute'),
+ 'On fetch event, registration attribute should be set');
+ // FIXME: Verify that...
+ // - registration.{installing, waiting} are null.
+ // - registration.active is set.
+ // (http://crbug.com/437677)
+ e.respondWith(new Response('PASS'));
+ });

Powered by Google App Engine
This is Rietveld 408576698