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..e1b1e93c90823370edd4b3f9794133e461a263be 100644 |
--- a/chrome/test/data/notifications/platform_notification_service.html |
+++ b/chrome/test/data/notifications/platform_notification_service.html |
@@ -21,6 +21,18 @@ |
}); |
} |
+ function DisplayNonPersistentNotification(title, options) { |
+ options = options || { body: 'Hello, world!', |
+ icon: 'icon.png' }; |
+ var notification = null; |
+ try { |
+ notification = new Notification(title, options); |
+ domAutomationController.send('ok'); |
+ } catch (error) { |
+ domAutomationController.send('' + error); |
+ } |
Peter Beverloo
2016/12/02 13:43:34
There's no reason for the Notification constructor
Miguel Garcia
2016/12/06 12:01:18
It will throw on Android. Then again these tests a
|
+ } |
+ |
// Renews the registered Service Worker registration for this page, then |
// displays a notification on the activated ServiceWorkerRegistration. |
function DisplayPersistentNotification(title, options) { |
@@ -127,6 +139,30 @@ |
}); |
} |
+ // 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); |
+ |
+ domAutomationController.send('ok'); |
+ }).catch(function (error) { |
+ domAutomationController.send('' + error); |
+ }); |
Peter Beverloo
2016/12/02 13:43:34
Please stick to Chromium's two-space indentation r
|
+ } |
+ |
// 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 |