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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/prefs/testing_pref_service.h" | 6 #include "base/prefs/testing_pref_service.h" |
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 "chrome/browser/notifications/message_center_notification_manager.h" | 10 #include "chrome/browser/notifications/message_center_notification_manager.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "ui/message_center/message_center_tray.h" | 23 #include "ui/message_center/message_center_tray.h" |
24 #include "ui/message_center/message_center_types.h" | 24 #include "ui/message_center/message_center_types.h" |
25 #include "ui/message_center/notification_types.h" | 25 #include "ui/message_center/notification_types.h" |
26 #include "ui/message_center/notifier_settings.h" | 26 #include "ui/message_center/notifier_settings.h" |
27 | 27 |
28 #if defined(OS_CHROMEOS) | 28 #if defined(OS_CHROMEOS) |
29 #include "chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chrom
eos.h" | 29 #include "chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chrom
eos.h" |
30 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 30 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
31 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 31 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
32 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" | 32 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" |
| 33 #include "components/signin/core/account_id/account_id.h" |
33 #endif | 34 #endif |
34 | 35 |
35 namespace message_center { | 36 namespace message_center { |
36 | 37 |
37 class MessageCenterNotificationManagerTest : public BrowserWithTestWindowTest { | 38 class MessageCenterNotificationManagerTest : public BrowserWithTestWindowTest { |
38 public: | 39 public: |
39 MessageCenterNotificationManagerTest() {} | 40 MessageCenterNotificationManagerTest() {} |
40 | 41 |
41 protected: | 42 protected: |
42 void SetUp() override { | 43 void SetUp() override { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 notification_manager()->Add(GetANotification("test"), &profile); | 108 notification_manager()->Add(GetANotification("test"), &profile); |
108 EXPECT_TRUE(message_center()->NotificationCount() == 1); | 109 EXPECT_TRUE(message_center()->NotificationCount() == 1); |
109 ASSERT_TRUE( | 110 ASSERT_TRUE( |
110 notification_manager()->Update(GetANotification("test"), &profile)); | 111 notification_manager()->Update(GetANotification("test"), &profile)); |
111 EXPECT_TRUE(message_center()->NotificationCount() == 1); | 112 EXPECT_TRUE(message_center()->NotificationCount() == 1); |
112 } | 113 } |
113 | 114 |
114 #if defined(OS_CHROMEOS) | 115 #if defined(OS_CHROMEOS) |
115 TEST_F(MessageCenterNotificationManagerTest, MultiUserUpdates) { | 116 TEST_F(MessageCenterNotificationManagerTest, MultiUserUpdates) { |
116 TestingProfile profile; | 117 TestingProfile profile; |
117 std::string active_user_id = multi_user_util::GetUserIDFromProfile(&profile); | 118 const AccountId active_user_id( |
| 119 multi_user_util::GetAccountIdFromProfile(&profile)); |
118 chrome::MultiUserWindowManagerChromeOS* multi_user_window_manager = | 120 chrome::MultiUserWindowManagerChromeOS* multi_user_window_manager = |
119 new chrome::MultiUserWindowManagerChromeOS(active_user_id); | 121 new chrome::MultiUserWindowManagerChromeOS(active_user_id); |
120 multi_user_window_manager->Init(); | 122 multi_user_window_manager->Init(); |
121 chrome::MultiUserWindowManager::SetInstanceForTest( | 123 chrome::MultiUserWindowManager::SetInstanceForTest( |
122 multi_user_window_manager, | 124 multi_user_window_manager, |
123 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED); | 125 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED); |
124 scoped_ptr<MultiUserNotificationBlockerChromeOS> blocker( | 126 scoped_ptr<MultiUserNotificationBlockerChromeOS> blocker( |
125 new MultiUserNotificationBlockerChromeOS( | 127 new MultiUserNotificationBlockerChromeOS( |
126 message_center::MessageCenter::Get(), | 128 message_center::MessageCenter::Get(), |
127 active_user_id)); | 129 active_user_id)); |
128 EXPECT_EQ(0u, message_center()->NotificationCount()); | 130 EXPECT_EQ(0u, message_center()->NotificationCount()); |
129 notification_manager()->Add(GetANotification("test"), &profile); | 131 notification_manager()->Add(GetANotification("test"), &profile); |
130 EXPECT_EQ(1u, message_center()->NotificationCount()); | 132 EXPECT_EQ(1u, message_center()->NotificationCount()); |
131 notification_manager()->Update(GetANotification("test"), &profile); | 133 notification_manager()->Update(GetANotification("test"), &profile); |
132 EXPECT_EQ(1u, message_center()->NotificationCount()); | 134 EXPECT_EQ(1u, message_center()->NotificationCount()); |
133 chrome::MultiUserWindowManager::DeleteInstance(); | 135 chrome::MultiUserWindowManager::DeleteInstance(); |
134 } | 136 } |
135 #endif | 137 #endif |
136 | 138 |
137 } // namespace message_center | 139 } // namespace message_center |
OLD | NEW |