OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/notifications/message_center_settings_controller.h" | 9 #include "chrome/browser/notifications/message_center_settings_controller.h" |
10 #include "chrome/browser/prefs/pref_service_syncable.h" | 10 #include "chrome/browser/prefs/pref_service_syncable.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 GetFakeUserManager()->UserLoggedIn(name, name + kUserIdHashSuffix, false); | 87 GetFakeUserManager()->UserLoggedIn(name, name + kUserIdHashSuffix, false); |
88 } | 88 } |
89 | 89 |
90 void SwitchActiveUser(const std::string& name) { | 90 void SwitchActiveUser(const std::string& name) { |
91 GetFakeUserManager()->SwitchActiveUser(name); | 91 GetFakeUserManager()->SwitchActiveUser(name); |
92 controller()->ActiveUserChanged(GetFakeUserManager()->GetActiveUser()); | 92 controller()->ActiveUserChanged(GetFakeUserManager()->GetActiveUser()); |
93 } | 93 } |
94 | 94 |
95 private: | 95 private: |
96 chromeos::FakeUserManager* GetFakeUserManager() { | 96 chromeos::FakeUserManager* GetFakeUserManager() { |
97 return static_cast<chromeos::FakeUserManager*>( | 97 return static_cast<chromeos::FakeUserManager*>(chromeos::GetUserManager()); |
98 chromeos::UserManager::Get()); | |
99 } | 98 } |
100 | 99 |
101 scoped_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_; | 100 scoped_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_; |
102 | 101 |
103 DISALLOW_COPY_AND_ASSIGN(MessageCenterSettingsControllerChromeOSTest); | 102 DISALLOW_COPY_AND_ASSIGN(MessageCenterSettingsControllerChromeOSTest); |
104 }; | 103 }; |
105 #endif // OS_CHROMEOS | 104 #endif // OS_CHROMEOS |
106 | 105 |
107 #if !defined(OS_CHROMEOS) | 106 #if !defined(OS_CHROMEOS) |
108 TEST_F(MessageCenterSettingsControllerTest, NotifierGroups) { | 107 TEST_F(MessageCenterSettingsControllerTest, NotifierGroups) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 SwitchActiveUser("Profile-1"); | 153 SwitchActiveUser("Profile-1"); |
155 EXPECT_EQ(controller()->GetNotifierGroupCount(), 1u); | 154 EXPECT_EQ(controller()->GetNotifierGroupCount(), 1u); |
156 EXPECT_EQ(controller()->GetNotifierGroupAt(0).name, | 155 EXPECT_EQ(controller()->GetNotifierGroupAt(0).name, |
157 base::UTF8ToUTF16("Profile-1")); | 156 base::UTF8ToUTF16("Profile-1")); |
158 EXPECT_EQ(controller()->GetNotifierGroupAt(0).index, 0u); | 157 EXPECT_EQ(controller()->GetNotifierGroupAt(0).index, 0u); |
159 } | 158 } |
160 #endif | 159 #endif |
161 | 160 |
162 // TODO(mukai): write a test case to reproduce the actual guest session scenario | 161 // TODO(mukai): write a test case to reproduce the actual guest session scenario |
163 // in ChromeOS -- no profiles in the profile_info_cache. | 162 // in ChromeOS -- no profiles in the profile_info_cache. |
OLD | NEW |