Index: content/test/data/background_sync/register_sync_sw.js |
diff --git a/content/test/data/background_sync/register_sync_sw.js b/content/test/data/background_sync/register_sync_sw.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..da7ff4cfc3ea89a961c9338ee0b5ab3d61e447c5 |
--- /dev/null |
+++ b/content/test/data/background_sync/register_sync_sw.js |
@@ -0,0 +1,22 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+'use strict'; |
+ |
+function sendMessageToClients(message) { |
+ clients.matchAll({ includeUncontrolled: true }).then(function(clients) { |
+ clients.forEach(function(client) { |
+ client.postMessage(message); |
+ }); |
+ }); |
+} |
+ |
+self.addEventListener('activate', function(event) { |
+ registration.sync.register('foo') |
+ .then(function () { |
+ sendMessageToClients('registration succeeded'); |
+ }, function(e) { |
+ sendMessageToClients('registration failed'); |
+ }); |
+}); |