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

Unified Diff: content/shell/browser/layout_test/layout_test_notification_manager.cc

Issue 1656823002: Add layout tests for ServiceWorker's notificationclose event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactored data reflection tests + nits Created 4 years, 11 months 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: 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..701b24b9fb6be227118e9e0cb4d2aac1f7b83c99 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,24 @@ 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);
+
+ 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,

Powered by Google App Engine
This is Rietveld 408576698