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

Side by Side Diff: chrome/test/data/push_messaging/service_worker.js

Issue 2452833004: Fix flaky SW registration in PushMessaging/BudgetManager browser tests (Closed)
Patch Set: Rebase Created 4 years, 1 month 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
« no previous file with comments | « chrome/test/data/push_messaging/push_test.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Use an absolute path since this could be loaded from a different scope, 5 // Use an absolute path since this could be loaded from a different scope,
6 // which would affect the scope of the importScripts call here. 6 // which would affect the scope of the importScripts call here.
7 self.importScripts('/push_messaging/push_constants.js'); 7 self.importScripts('/push_messaging/push_constants.js');
8 8
9 // Don't wait for clients of old SW to close before activating.
10 self.addEventListener('install', () => skipWaiting());
11
9 // The "onpush" event currently understands two values as message payload 12 // The "onpush" event currently understands two values as message payload
10 // data coming from the test. Any other input is passed through to the 13 // data coming from the test. Any other input is passed through to the
11 // document unchanged. 14 // document unchanged.
12 // 15 //
13 // "shownotification" - Display a Web Notification with event.waitUntil(). 16 // "shownotification" - Display a Web Notification with event.waitUntil().
14 // "shownotification-without-waituntil" 17 // "shownotification-without-waituntil"
15 // - Display a Web Notification without using event.waitUntil(). 18 // - Display a Web Notification without using event.waitUntil().
16 this.onpush = function(event) { 19 this.onpush = function(event) {
17 if (event.data === null) { 20 if (event.data === null) {
18 sendMessageToClients('push', '[NULL]'); 21 sendMessageToClients('push', '[NULL]');
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 'data': data 76 'data': data
74 }); 77 });
75 clients.matchAll().then(function(clients) { 78 clients.matchAll().then(function(clients) {
76 clients.forEach(function(client) { 79 clients.forEach(function(client) {
77 client.postMessage(message); 80 client.postMessage(message);
78 }); 81 });
79 }, function(error) { 82 }, function(error) {
80 console.log(error); 83 console.log(error);
81 }); 84 });
82 } 85 }
OLDNEW
« no previous file with comments | « chrome/test/data/push_messaging/push_test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698