Index: chrome/test/data/notifications/platform_notification_service.html |
diff --git a/chrome/test/data/notifications/platform_notification_service.html b/chrome/test/data/notifications/platform_notification_service.html |
index 88b2ac3e4c5f1cfe8c41ee8be80bf3ac7688ba7d..4be95161f173df973dc6da1fffd564aae6e32602 100644 |
--- a/chrome/test/data/notifications/platform_notification_service.html |
+++ b/chrome/test/data/notifications/platform_notification_service.html |
@@ -21,6 +21,14 @@ |
}); |
} |
+ function DisplayNonPersistentNotification(title, options) { |
+ const notification = new Notification(title, options || {}); |
+ notification.addEventListener('show', e => |
+ domAutomationController.send('ok')); |
+ notification.addEventListener('error', e => |
+ domAutomationController.send('could not show notification')); |
+ } |
+ |
// Renews the registered Service Worker registration for this page, then |
// displays a notification on the activated ServiceWorkerRegistration. |
function DisplayPersistentNotification(title, options) { |
@@ -127,6 +135,29 @@ |
}); |
} |
+ // Gets a comma separated list of currently displayed notification titles |
+ function GetDisplayedNotifications() { |
+ GetActivatedServiceWorker('platform_notification_service.js', |
+ location.pathname).then(function (sw) { |
+ return sw.getNotifications(); |
+ }).then(function (notifications) { |
+ var notificationResult = ''; |
+ for (var i = 0; i < notifications.length; ++i) { |
+ notificationResult = notificationResult.concat(notifications[i].title); |
+ if (i < (notifications.length -1)) |
+ notificationResult = notificationResult.concat(','); |
+ } |
+ if (expectingMessage) |
+ domAutomationController.send(notificationResult); |
+ else |
+ messageStack.push(notificationResult); |
Peter Beverloo
2016/12/06 13:04:02
micro nit: -2 space indent for lines 146-153
Miguel Garcia
2016/12/07 17:20:50
Done.
|
+ |
+ domAutomationController.send('ok'); |
+ }).catch(function (error) { |
+ domAutomationController.send('' + error); |
+ }); |
+ } |
+ |
// Returns the latest received message from the worker. If no message has |
// been received, nothing will be done. For successfully registered |
// Service Workers this is OK, however, since the "message" event handler |