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

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

Issue 673783003: BrowserTest for delivering push message to service worker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PushIntegrationTest2
Patch Set: Break long line. Created 6 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
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 // Empty service worker script. 5 this.onpush = function(event) {
6 sendMessageToClients('push', event.data);
7 };
6 8
7 // TODO(mvanouwerkerk): Add test coverage for push event delivery. 9 function sendMessageToClients(type, data) {
10 var message = JSON.stringify({
11 'type': type,
12 'data': data
13 });
14 clients.getAll().then(function(clients) {
15 clients.forEach(function(client) {
16 client.postMessage(message);
17 });
18 }, function(error) {
19 console.log(error);
20 });
21 }
OLDNEW
« no previous file with comments | « chrome/browser/services/gcm/push_messaging_browsertest.cc ('k') | chrome/test/data/push_messaging/test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698