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

Unified Diff: chrome/browser/notifications/message_center_notifications_unittest.cc

Issue 2860473002: [Merge to M58] CrOS: Do not allow notifications to be added during shutdown. (Closed)
Patch Set: Created 3 years, 8 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/notifications/message_center_notifications_unittest.cc
diff --git a/chrome/browser/notifications/message_center_notifications_unittest.cc b/chrome/browser/notifications/message_center_notifications_unittest.cc
index 742031378daffea905c851c2aa577578d4c2f5a4..e47239b505da0c4ba944a58b9105e17e8680892d 100644
--- a/chrome/browser/notifications/message_center_notifications_unittest.cc
+++ b/chrome/browser/notifications/message_center_notifications_unittest.cc
@@ -51,7 +51,6 @@ class MessageCenterNotificationManagerTest : public BrowserWithTestWindowTest {
MessageCenter::Initialize();
#endif
-
TestingBrowserProcess* browser_process = TestingBrowserProcess::GetGlobal();
profile_manager_.reset(new TestingProfileManager(browser_process));
ASSERT_TRUE(profile_manager_->SetUp());
@@ -104,6 +103,20 @@ TEST_F(MessageCenterNotificationManagerTest, SetupNotificationManager) {
notification_manager()->Add(GetANotification("test"), &profile);
}
+TEST_F(MessageCenterNotificationManagerTest, AddNotificationOnShutdown) {
+ TestingProfile profile;
+ EXPECT_TRUE(message_center()->NotificationCount() == 0);
+ notification_manager()->Add(GetANotification("test"), &profile);
+ EXPECT_TRUE(message_center()->NotificationCount() == 1);
+
+ // Verify the number of notifications does not increase when trying to add a
+ // notifcation on shutdown.
+ notification_manager()->StartShutdown();
+ EXPECT_TRUE(message_center()->NotificationCount() == 0);
+ notification_manager()->Add(GetANotification("test2"), &profile);
+ EXPECT_TRUE(message_center()->NotificationCount() == 0);
+}
+
TEST_F(MessageCenterNotificationManagerTest, UpdateNotification) {
TestingProfile profile;
EXPECT_TRUE(message_center()->NotificationCount() == 0);

Powered by Google App Engine
This is Rietveld 408576698