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

Unified Diff: ui/message_center/notification_list_unittest.cc

Issue 11778012: Changes the OnClick behavior in message center. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « ui/message_center/notification_list.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/notification_list_unittest.cc
diff --git a/ui/message_center/notification_list_unittest.cc b/ui/message_center/notification_list_unittest.cc
index 4244d1164764c836522e92e6b9567406222c4c81..f863280cfb9bc3d70f10231f8371bef4bd583774 100644
--- a/ui/message_center/notification_list_unittest.cc
+++ b/ui/message_center/notification_list_unittest.cc
@@ -317,6 +317,57 @@ TEST_F(NotificationListTest, NotificationOrderAndPriority) {
EXPECT_EQ(default_id, iter->id);
}
+TEST_F(NotificationListTest, MarkSinglePopupAsShown) {
+ std::string id1 = AddNotification(NULL);
+ std::string id2 = AddNotification(NULL);
+ ASSERT_EQ(2u, notification_list()->NotificationCount());
+ ASSERT_EQ(2u, GetPopupCounts());
+
+ notification_list()->MarkSinglePopupAsShown(id2);
+ EXPECT_EQ(2u, notification_list()->NotificationCount());
+ EXPECT_EQ(1u, GetPopupCounts());
+ NotificationList::Notifications popups;
+ notification_list()->GetPopupNotifications(&popups);
+ EXPECT_EQ(id1, popups.begin()->id);
+
+ // Reorder happens -- popup-notifications should be at the beginning of the
+ // list.
+ // TODO(mukai): confirm this behavior is expected.
+ NotificationList::Notifications notifications;
+ notification_list()->GetNotifications(&notifications);
+ NotificationList::Notifications::const_iterator iter = notifications.begin();
+ EXPECT_EQ(id1, iter->id);
+ iter++;
+ EXPECT_EQ(id2, iter->id);
+
+ // Trickier scenario.
+ notification_list()->MarkPopupsAsShown(ui::notifications::DEFAULT_PRIORITY);
+ std::string id3 = AddNotification(NULL);
+ std::string id4 = AddNotification(NULL);
+ std::string id5 = AddNotification(NULL);
+ notification_list()->MarkSinglePopupAsShown(id4);
+ popups.clear();
+ notifications.clear();
+ notification_list()->GetPopupNotifications(&popups);
+ notification_list()->GetNotifications(&notifications);
+ EXPECT_EQ(2u, popups.size());
+ iter = popups.begin();
+ EXPECT_EQ(id5, iter->id);
+ iter++;
+ EXPECT_EQ(id3, iter->id);
+ EXPECT_EQ(5u, notifications.size());
+ iter = notifications.begin();
+ EXPECT_EQ(id5, iter->id);
+ iter++;
+ EXPECT_EQ(id3, iter->id);
+ iter++;
+ EXPECT_EQ(id4, iter->id);
+ iter++;
+ EXPECT_EQ(id1, iter->id);
+ iter++;
+ EXPECT_EQ(id2, iter->id);
+}
+
TEST_F(NotificationListTest, QuietMode) {
notification_list()->SetQuietMode(true);
AddNotification(NULL);
« no previous file with comments | « ui/message_center/notification_list.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698