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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/ServiceWorkerGlobalScope/resources/update-worker.js

Issue 2415873002: Import w3c tests for the service workers (Closed)
Patch Set: Rebase Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 <?php 1 importScripts('../../resources/test-helpers.sub.js');
2 // update() does not bypass cache so set the max-age to 0 such that update()
3 // can find a new version in the network.
4 header('Cache-Control: max-age=0');
5
6 // Return a different script for each access.
7 header('Content-Type:application/javascript');
8 echo '// ' . microtime();
9 ?>
10
11 importScripts('../../resources/test-helpers.js');
12 importScripts('../../resources/worker-testharness.js'); 2 importScripts('../../resources/worker-testharness.js');
13 3
14 var events_seen = []; 4 var events_seen = [];
15 5
16 self.registration.addEventListener('updatefound', function() { 6 self.registration.addEventListener('updatefound', function() {
17 events_seen.push('updatefound'); 7 events_seen.push('updatefound');
18 }); 8 });
19 9
20 self.addEventListener('activate', function(e) { 10 self.addEventListener('activate', function(e) {
21 events_seen.push('activate'); 11 events_seen.push('activate');
22 }); 12 });
23 13
24 self.addEventListener('fetch', function(e) { 14 self.addEventListener('fetch', function(e) {
25 events_seen.push('fetch'); 15 events_seen.push('fetch');
26 e.respondWith(new Response(events_seen)); 16 e.respondWith(new Response(events_seen));
27 }); 17 });
28 18
29 self.addEventListener('message', function(e) { 19 self.addEventListener('message', function(e) {
30 events_seen.push('message'); 20 events_seen.push('message');
31 self.registration.update(); 21 self.registration.update();
32 }); 22 });
33 23
34 // update() during the script evaluation should be ignored. 24 // update() during the script evaluation should be ignored.
35 self.registration.update(); 25 self.registration.update();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698