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

Unified Diff: chrome/browser/ui/views/message_center/web_notification_tray_browsertest.cc

Issue 324583002: The 1st patch to disambiguate message center notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 6 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: chrome/browser/ui/views/message_center/web_notification_tray_browsertest.cc
diff --git a/chrome/browser/ui/views/message_center/web_notification_tray_browsertest.cc b/chrome/browser/ui/views/message_center/web_notification_tray_browsertest.cc
index 0c3d7f04c1a12ac37509381b8cd2a161d502cf97..d0ad7d2b4ae2550c5b813dbc1af6e218fe11e038 100644
--- a/chrome/browser/ui/views/message_center/web_notification_tray_browsertest.cc
+++ b/chrome/browser/ui/views/message_center/web_notification_tray_browsertest.cc
@@ -96,6 +96,11 @@ class WebNotificationTrayTest : public InProcessBrowserTest {
g_browser_process->notification_ui_manager()->CancelById(id);
}
+ bool HasNotification(message_center::MessageCenter* message_center,
+ const std::string& id) {
+ return message_center->FindVisibleNotificationById(id) != NULL;
+ }
+
private:
DISALLOW_COPY_AND_ASSIGN(WebNotificationTrayTest);
};
@@ -111,28 +116,28 @@ IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest, WebNotifications) {
// Add a notification.
AddNotification("test_id1", "replace_id1");
EXPECT_EQ(1u, message_center->NotificationCount());
- EXPECT_TRUE(message_center->HasNotification("test_id1"));
- EXPECT_FALSE(message_center->HasNotification("test_id2"));
+ EXPECT_TRUE(HasNotification(message_center, "test_id1"));
+ EXPECT_FALSE(HasNotification(message_center, "test_id2"));
AddNotification("test_id2", "replace_id2");
AddNotification("test_id2", "replace_id2");
EXPECT_EQ(2u, message_center->NotificationCount());
- EXPECT_TRUE(message_center->HasNotification("test_id2"));
+ EXPECT_TRUE(HasNotification(message_center, "test_id1"));
// Ensure that updating a notification does not affect the count.
UpdateNotification("replace_id2", "test_id3");
UpdateNotification("replace_id2", "test_id3");
EXPECT_EQ(2u, message_center->NotificationCount());
- EXPECT_FALSE(message_center->HasNotification("test_id2"));
+ EXPECT_FALSE(HasNotification(message_center, "test_id2"));
// Ensure that Removing the first notification removes it from the tray.
RemoveNotification("test_id1");
- EXPECT_FALSE(message_center->HasNotification("test_id1"));
+ EXPECT_FALSE(HasNotification(message_center, "test_id1"));
EXPECT_EQ(1u, message_center->NotificationCount());
// Remove the remaining notification.
RemoveNotification("test_id3");
EXPECT_EQ(0u, message_center->NotificationCount());
- EXPECT_FALSE(message_center->HasNotification("test_id3"));
+ EXPECT_FALSE(HasNotification(message_center, "test_id1"));
}
IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest, WebNotificationPopupBubble) {
« no previous file with comments | « chrome/browser/notifications/message_center_notification_manager.cc ('k') | ui/message_center/cocoa/tray_view_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698