Index: chrome/test/data/notifications/platform_notification_service.js |
diff --git a/chrome/test/data/notifications/platform_notification_service.js b/chrome/test/data/notifications/platform_notification_service.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..430abd77fc9b58fb1b3efc0cd34017bf36621ae4 |
--- /dev/null |
+++ b/chrome/test/data/notifications/platform_notification_service.js |
@@ -0,0 +1,17 @@ |
+// Service Worker to be used with the platform_notification_service.html page. |
+var messagePort = null; |
+ |
+addEventListener('message', function (event) { |
+ messagePort = event.data; |
+ messagePort.postMessage('ready'); |
+}); |
+ |
+// The notificationclick event will be invoked when a persistent notification |
+// has been clicked on. When this happens, the title determines whether this |
+// Service Worker has to act upon this. |
+addEventListener('notificationclick', function (event) { |
+ if (event.notification.title == 'action_close') |
+ event.notification.close(); |
+ |
+ messagePort.postMessage(event.notification.title); |
+}); |