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

Unified Diff: chrome/test/data/notifications/platform_notification_service.html

Issue 2534443002: Use notification display service to collect persistent notifications. (Closed)
Patch Set: fix layout tests Created 4 years 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698