| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 std::unique_ptr<TestingProfileManager> profile_manager_; | 97 std::unique_ptr<TestingProfileManager> profile_manager_; |
| 98 MessageCenter* message_center_; | 98 MessageCenter* message_center_; |
| 99 FakeMessageCenterTrayDelegate* delegate_; | 99 FakeMessageCenterTrayDelegate* delegate_; |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 TEST_F(MessageCenterNotificationManagerTest, SetupNotificationManager) { | 102 TEST_F(MessageCenterNotificationManagerTest, SetupNotificationManager) { |
| 103 TestingProfile profile; | 103 TestingProfile profile; |
| 104 notification_manager()->Add(GetANotification("test"), &profile); | 104 notification_manager()->Add(GetANotification("test"), &profile); |
| 105 } | 105 } |
| 106 | 106 |
| 107 TEST_F(MessageCenterNotificationManagerTest, AddNotificationOnShutdown) { |
| 108 TestingProfile profile; |
| 109 EXPECT_TRUE(message_center()->NotificationCount() == 0); |
| 110 notification_manager()->Add(GetANotification("test"), &profile); |
| 111 EXPECT_TRUE(message_center()->NotificationCount() == 1); |
| 112 |
| 113 // Verify the number of notifications does not increase when trying to add a |
| 114 // notifcation on shutdown. |
| 115 TestingBrowserProcess::GetGlobal()->SetShuttingDown(true); |
| 116 notification_manager()->Add(GetANotification("test2"), &profile); |
| 117 EXPECT_TRUE(message_center()->NotificationCount() == 1); |
| 118 TestingBrowserProcess::GetGlobal()->SetShuttingDown(false); |
| 119 } |
| 120 |
| 107 TEST_F(MessageCenterNotificationManagerTest, UpdateNotification) { | 121 TEST_F(MessageCenterNotificationManagerTest, UpdateNotification) { |
| 108 TestingProfile profile; | 122 TestingProfile profile; |
| 109 EXPECT_TRUE(message_center()->NotificationCount() == 0); | 123 EXPECT_TRUE(message_center()->NotificationCount() == 0); |
| 110 notification_manager()->Add(GetANotification("test"), &profile); | 124 notification_manager()->Add(GetANotification("test"), &profile); |
| 111 EXPECT_TRUE(message_center()->NotificationCount() == 1); | 125 EXPECT_TRUE(message_center()->NotificationCount() == 1); |
| 112 ASSERT_TRUE( | 126 ASSERT_TRUE( |
| 113 notification_manager()->Update(GetANotification("test"), &profile)); | 127 notification_manager()->Update(GetANotification("test"), &profile)); |
| 114 EXPECT_TRUE(message_center()->NotificationCount() == 1); | 128 EXPECT_TRUE(message_center()->NotificationCount() == 1); |
| 115 } | 129 } |
| 116 | 130 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 131 EXPECT_EQ(0u, message_center()->NotificationCount()); | 145 EXPECT_EQ(0u, message_center()->NotificationCount()); |
| 132 notification_manager()->Add(GetANotification("test"), &profile); | 146 notification_manager()->Add(GetANotification("test"), &profile); |
| 133 EXPECT_EQ(1u, message_center()->NotificationCount()); | 147 EXPECT_EQ(1u, message_center()->NotificationCount()); |
| 134 notification_manager()->Update(GetANotification("test"), &profile); | 148 notification_manager()->Update(GetANotification("test"), &profile); |
| 135 EXPECT_EQ(1u, message_center()->NotificationCount()); | 149 EXPECT_EQ(1u, message_center()->NotificationCount()); |
| 136 chrome::MultiUserWindowManager::DeleteInstance(); | 150 chrome::MultiUserWindowManager::DeleteInstance(); |
| 137 } | 151 } |
| 138 #endif | 152 #endif |
| 139 | 153 |
| 140 } // namespace message_center | 154 } // namespace message_center |
| OLD | NEW |