Index: content/shell/browser/layout_test/layout_test_notification_manager.cc |
diff --git a/content/shell/browser/layout_test/layout_test_notification_manager.cc b/content/shell/browser/layout_test/layout_test_notification_manager.cc |
index f4f1864b15456d64180cb520fdec725a35079c51..77584f05124bae8d573b148a49f1e7e5724ce46a 100644 |
--- a/content/shell/browser/layout_test/layout_test_notification_manager.cc |
+++ b/content/shell/browser/layout_test/layout_test_notification_manager.cc |
@@ -134,6 +134,32 @@ void LayoutTestNotificationManager::SimulateClick(const std::string& title, |
base::Bind(&OnEventDispatchComplete)); |
} |
+void LayoutTestNotificationManager::SimulateClose(const std::string& title, |
+ bool by_user) { |
+ DCHECK_CURRENTLY_ON(BrowserThread::UI); |
+ |
+ // First check for page-notifications with the given title. |
+ const auto& page_iterator = page_notifications_.find(title); |
+ if (page_iterator != page_notifications_.end()) { |
+ page_iterator->second->NotificationClosed(); |
Peter Beverloo
2016/02/02 23:50:10
No need to check for in-page notifications here -
Nina
2016/02/03 15:04:23
Removed.
|
+ return; |
+ } |
+ |
+ // Then check for persistent notifications with the given title. |
+ const auto& persistent_iterator = persistent_notifications_.find(title); |
+ if (persistent_iterator == persistent_notifications_.end()) |
+ return; |
+ |
+ const PersistentNotification& notification = persistent_iterator->second; |
+ content::NotificationEventDispatcher::GetInstance() |
+ ->DispatchNotificationCloseEvent( |
+ notification.browser_context, |
+ notification.persistent_id, |
+ notification.origin, |
+ by_user, |
+ base::Bind(&OnEventDispatchComplete)); |
+} |
+ |
blink::WebNotificationPermission |
LayoutTestNotificationManager::CheckPermissionOnUIThread( |
BrowserContext* browser_context, |