summaryrefslogtreecommitdiff
path: root/chromium/ui/message_center/message_center_impl_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/message_center/message_center_impl_unittest.cc')
-rw-r--r--chromium/ui/message_center/message_center_impl_unittest.cc33
1 files changed, 31 insertions, 2 deletions
diff --git a/chromium/ui/message_center/message_center_impl_unittest.cc b/chromium/ui/message_center/message_center_impl_unittest.cc
index 6b05dc598bb..f9bfc75a2f7 100644
--- a/chromium/ui/message_center/message_center_impl_unittest.cc
+++ b/chromium/ui/message_center/message_center_impl_unittest.cc
@@ -148,8 +148,8 @@ class MessageCenterImplTest : public testing::Test {
void SetUp() override {
MessageCenter::Initialize(std::make_unique<FakeLockScreenController>());
message_center_ = MessageCenter::Get();
- loop_.reset(new base::MessageLoop);
- run_loop_.reset(new base::RunLoop());
+ loop_ = std::make_unique<base::MessageLoop>();
+ run_loop_ = std::make_unique<base::RunLoop>();
closure_ = run_loop_->QuitClosure();
}
@@ -457,6 +457,35 @@ TEST_F(MessageCenterImplTest, PopupTimersControllerRestartOnUpdate) {
base::MessageLoopCurrent::Get()->SetTaskRunner(old_task_runner);
}
+TEST_F(MessageCenterImplTest, Renotify) {
+ message_center()->SetHasMessageCenterView(true);
+ const std::string id("id");
+
+ // Add notification initially.
+ std::unique_ptr<Notification> notification = CreateSimpleNotification(id);
+ message_center()->AddNotification(std::move(notification));
+ auto popups = message_center()->GetPopupNotifications();
+ EXPECT_EQ(1u, popups.size());
+ EXPECT_TRUE(PopupNotificationsContain(popups, id));
+
+ // Mark notification as shown.
+ message_center()->MarkSinglePopupAsShown(id, true);
+ EXPECT_EQ(0u, message_center()->GetPopupNotifications().size());
+
+ // Add notification again without |renotify| flag. It should not pop-up again.
+ notification = CreateSimpleNotification(id);
+ message_center()->AddNotification(std::move(notification));
+ EXPECT_EQ(0u, message_center()->GetPopupNotifications().size());
+
+ // Add notification again with |renotify| flag. It should pop-up again.
+ notification = CreateSimpleNotification(id);
+ notification->set_renotify(true);
+ message_center()->AddNotification(std::move(notification));
+ popups = message_center()->GetPopupNotifications();
+ EXPECT_EQ(1u, popups.size());
+ EXPECT_TRUE(PopupNotificationsContain(popups, id));
+}
+
TEST_F(MessageCenterImplTest, NotificationBlocker) {
NotifierId notifier_id(NotifierType::APPLICATION, "app1");
// Multiple blockers to verify the case that one blocker blocks but another