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

Unified Diff: LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/update-worker.php

Issue 1177563005: ServiceWorker: Implement ServiceWorkerRegistration.update() (3) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@implement_update_1
Patch Set: incorporate falken@'s comments Created 5 years, 6 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/update.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/update-worker.php
diff --git a/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/update-worker.php b/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/update-worker.php
new file mode 100644
index 0000000000000000000000000000000000000000..2486820c26c5f6483270a2d15f6527ec3ee11662
--- /dev/null
+++ b/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/update-worker.php
@@ -0,0 +1,35 @@
+<?php
+// Force the browser to cache this script. update() should always bypass this
+// cache and fetch a new version.
+header('Cache-Control: max-age=86400');
+
+// Return a different script for each access.
+header('Content-Type:application/javascript');
+echo '// ' . microtime();
+?>
+
+importScripts('../../resources/test-helpers.js');
+importScripts('../../resources/worker-testharness.js');
+
+var events_seen = [];
+
+self.registration.addEventListener('updatefound', function() {
+ events_seen.push('updatefound');
+ });
+
+self.addEventListener('activate', function(e) {
+ events_seen.push('activate');
+ });
+
+self.addEventListener('fetch', function(e) {
+ events_seen.push('fetch');
+ e.respondWith(new Response(events_seen));
+ });
+
+self.addEventListener('message', function(e) {
+ events_seen.push('message');
+ self.registration.update();
+ });
+
+// update() during the script evaluation should be ignored.
+self.registration.update();
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/update.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698