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

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

Issue 2776933006: CrOS: Do not allow notifications to be added during shutdown. (Closed)
Patch Set: Created 3 years, 9 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..459ec30ddd6258f63e30a2909482be2335d54571 100644
--- a/chrome/browser/notifications/message_center_notifications_unittest.cc
+++ b/chrome/browser/notifications/message_center_notifications_unittest.cc
@@ -104,6 +104,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.
+ TestingBrowserProcess::GetGlobal()->SetShuttingDown(true);
+ notification_manager()->Add(GetANotification("test2"), &profile);
+ EXPECT_TRUE(message_center()->NotificationCount() == 1);
+ TestingBrowserProcess::GetGlobal()->SetShuttingDown(false);
+}
+
TEST_F(MessageCenterNotificationManagerTest, UpdateNotification) {
TestingProfile profile;
EXPECT_TRUE(message_center()->NotificationCount() == 0);

Powered by Google App Engine
This is Rietveld 408576698