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

Unified Diff: ui/message_center/notification_list_unittest.cc

Issue 11827010: Fixes the policy to choose the notifications for popups. (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..505dce591dda22dde92f98c02b2d9b1926cfc350 100644
--- a/ui/message_center/notification_list_unittest.cc
+++ b/ui/message_center/notification_list_unittest.cc
@@ -212,6 +212,33 @@ TEST_F(NotificationListTest, SendRemoveNotifications) {
EXPECT_EQ(3u, delegate()->GetSendRemoveCountAndReset());
}
+TEST_F(NotificationListTest, OldPopupShouldNotBeHidden) {
+ std::vector<std::string> ids;
+ for (size_t i = 0; i <= NotificationList::kMaxVisiblePopupNotifications;
+ i++) {
+ ids.push_back(AddNotification(NULL));
+ }
+
+ NotificationList::Notifications popups;
+ notification_list()->GetPopupNotifications(&popups);
+ // The popup should contain the oldest kMaxVisiblePopupNotifications. Newer
+ // one should come earlier in the popup list. It means, the last element
+ // of |popups| should be the firstly added one, and so on.
+ EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, popups.size());
+ NotificationList::Notifications::const_reverse_iterator iter =
+ popups.rbegin();
+ for (size_t i = 0; i < NotificationList::kMaxVisiblePopupNotifications;
+ ++i, ++iter) {
+ EXPECT_EQ(ids[i], iter->id) << i;
+ }
+
+ notification_list()->MarkPopupsAsShown(ui::notifications::DEFAULT_PRIORITY);
+ popups.clear();
+ notification_list()->GetPopupNotifications(&popups);
+ EXPECT_EQ(1u, popups.size());
+ EXPECT_EQ(ids[ids.size() - 1], popups.begin()->id);
+}
+
TEST_F(NotificationListTest, Priority) {
ASSERT_EQ(0u, notification_list()->NotificationCount());
ASSERT_EQ(0u, notification_list()->unread_count());
« 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