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

Side by Side Diff: ui/message_center/message_center_impl_unittest.cc

Issue 1645843003: Implement Non-Closable Notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary property. Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « ui/message_center/message_center_impl.cc ('k') | ui/message_center/notification.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/message_center/message_center_impl.h" 5 #include "ui/message_center/message_center_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 EXPECT_TRUE(NotificationsContain(notifications, "id4")); 552 EXPECT_TRUE(NotificationsContain(notifications, "id4"));
553 553
554 blocker.SetNotificationsEnabled(true); 554 blocker.SetNotificationsEnabled(true);
555 EXPECT_EQ(4u, message_center()->NotificationCount()); 555 EXPECT_EQ(4u, message_center()->NotificationCount());
556 notifications = message_center()->GetVisibleNotifications(); 556 notifications = message_center()->GetVisibleNotifications();
557 EXPECT_TRUE(NotificationsContain(notifications, "id1")); 557 EXPECT_TRUE(NotificationsContain(notifications, "id1"));
558 EXPECT_TRUE(NotificationsContain(notifications, "id2")); 558 EXPECT_TRUE(NotificationsContain(notifications, "id2"));
559 EXPECT_TRUE(NotificationsContain(notifications, "id3")); 559 EXPECT_TRUE(NotificationsContain(notifications, "id3"));
560 EXPECT_TRUE(NotificationsContain(notifications, "id4")); 560 EXPECT_TRUE(NotificationsContain(notifications, "id4"));
561 561
562 // RemoveAllVisibleNotifications should remove just visible notifications. 562 // Remove just visible notifications.
563 blocker.SetNotificationsEnabled(false); 563 blocker.SetNotificationsEnabled(false);
564 message_center()->RemoveAllVisibleNotifications(false /* by_user */); 564 message_center()->RemoveAllNotifications(
565 false /* by_user */, MessageCenter::RemoveType::NON_PINNED);
565 EXPECT_EQ(0u, message_center()->NotificationCount()); 566 EXPECT_EQ(0u, message_center()->NotificationCount());
566 blocker.SetNotificationsEnabled(true); 567 blocker.SetNotificationsEnabled(true);
567 EXPECT_EQ(2u, message_center()->NotificationCount()); 568 EXPECT_EQ(2u, message_center()->NotificationCount());
568 notifications = message_center()->GetVisibleNotifications(); 569 notifications = message_center()->GetVisibleNotifications();
569 EXPECT_TRUE(NotificationsContain(notifications, "id1")); 570 EXPECT_TRUE(NotificationsContain(notifications, "id1"));
570 EXPECT_FALSE(NotificationsContain(notifications, "id2")); 571 EXPECT_FALSE(NotificationsContain(notifications, "id2"));
571 EXPECT_TRUE(NotificationsContain(notifications, "id3")); 572 EXPECT_TRUE(NotificationsContain(notifications, "id3"));
572 EXPECT_FALSE(NotificationsContain(notifications, "id4")); 573 EXPECT_FALSE(NotificationsContain(notifications, "id4"));
573 574
574 // And RemoveAllNotifications should remove all. 575 // And remove all including invisible notifications.
575 blocker.SetNotificationsEnabled(false); 576 blocker.SetNotificationsEnabled(false);
576 message_center()->RemoveAllNotifications(false /* by_user */); 577 message_center()->RemoveAllNotifications(false /* by_user */,
578 MessageCenter::RemoveType::ALL);
577 EXPECT_EQ(0u, message_center()->NotificationCount()); 579 EXPECT_EQ(0u, message_center()->NotificationCount());
578 } 580 }
579 581
580 #if defined(OS_CHROMEOS) 582 #if defined(OS_CHROMEOS)
581 TEST_F(MessageCenterImplTest, CachedUnreadCount) { 583 TEST_F(MessageCenterImplTest, CachedUnreadCount) {
582 message_center()->AddNotification( 584 message_center()->AddNotification(
583 scoped_ptr<Notification>(CreateSimpleNotification("id1"))); 585 scoped_ptr<Notification>(CreateSimpleNotification("id1")));
584 message_center()->AddNotification( 586 message_center()->AddNotification(
585 scoped_ptr<Notification>(CreateSimpleNotification("id2"))); 587 scoped_ptr<Notification>(CreateSimpleNotification("id2")));
586 message_center()->AddNotification( 588 message_center()->AddNotification(
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 // Then open the message center. 1177 // Then open the message center.
1176 message_center()->SetVisibility(VISIBILITY_MESSAGE_CENTER); 1178 message_center()->SetVisibility(VISIBILITY_MESSAGE_CENTER);
1177 1179
1178 // Then update a notification; the update should have propagated. 1180 // Then update a notification; the update should have propagated.
1179 message_center()->RemoveNotification(id, false); 1181 message_center()->RemoveNotification(id, false);
1180 EXPECT_FALSE(message_center()->FindVisibleNotificationById(id)); 1182 EXPECT_FALSE(message_center()->FindVisibleNotificationById(id));
1181 } 1183 }
1182 1184
1183 } // namespace internal 1185 } // namespace internal
1184 } // namespace message_center 1186 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/message_center_impl.cc ('k') | ui/message_center/notification.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698