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

Side by Side Diff: chrome/browser/notifications/message_center_settings_controller_unittest.cc

Issue 444903002: [cros] user_manager component - move UserManagerBase and UserManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/browser/profiles/profile_info_cache.h" 11 #include "chrome/browser/profiles/profile_info_cache.h"
12 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/test/base/testing_browser_process.h" 13 #include "chrome/test/base/testing_browser_process.h"
14 #include "chrome/test/base/testing_profile_manager.h" 14 #include "chrome/test/base/testing_profile_manager.h"
15 #include "content/public/test/test_browser_thread_bundle.h" 15 #include "content/public/test/test_browser_thread_bundle.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/message_center/notifier_settings.h" 17 #include "ui/message_center/notifier_settings.h"
18 18
19 #if defined(OS_CHROMEOS) 19 #if defined(OS_CHROMEOS)
20 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" 20 #include "chrome/browser/chromeos/login/users/fake_user_manager.h"
21 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
21 #endif 22 #endif
22 23
23 class MessageCenterSettingsControllerTest : public testing::Test { 24 class MessageCenterSettingsControllerTest : public testing::Test {
24 protected: 25 protected:
25 MessageCenterSettingsControllerTest() 26 MessageCenterSettingsControllerTest()
26 : testing_profile_manager_(TestingBrowserProcess::GetGlobal()) {}; 27 : testing_profile_manager_(TestingBrowserProcess::GetGlobal()) {};
27 virtual ~MessageCenterSettingsControllerTest() {}; 28 virtual ~MessageCenterSettingsControllerTest() {};
28 29
29 base::FilePath GetProfilePath(const std::string& base_name) { 30 base::FilePath GetProfilePath(const std::string& base_name) {
30 return testing_profile_manager_.profile_manager()->user_data_dir() 31 return testing_profile_manager_.profile_manager()->user_data_dir()
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 90 }
90 91
91 void SwitchActiveUser(const std::string& name) { 92 void SwitchActiveUser(const std::string& name) {
92 GetFakeUserManager()->SwitchActiveUser(name); 93 GetFakeUserManager()->SwitchActiveUser(name);
93 controller()->ActiveUserChanged(GetFakeUserManager()->GetActiveUser()); 94 controller()->ActiveUserChanged(GetFakeUserManager()->GetActiveUser());
94 } 95 }
95 96
96 private: 97 private:
97 chromeos::FakeUserManager* GetFakeUserManager() { 98 chromeos::FakeUserManager* GetFakeUserManager() {
98 return static_cast<chromeos::FakeUserManager*>( 99 return static_cast<chromeos::FakeUserManager*>(
99 chromeos::UserManager::Get()); 100 user_manager::UserManager::Get());
100 } 101 }
101 102
102 scoped_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_; 103 scoped_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_;
103 104
104 DISALLOW_COPY_AND_ASSIGN(MessageCenterSettingsControllerChromeOSTest); 105 DISALLOW_COPY_AND_ASSIGN(MessageCenterSettingsControllerChromeOSTest);
105 }; 106 };
106 #endif // OS_CHROMEOS 107 #endif // OS_CHROMEOS
107 108
108 #if !defined(OS_CHROMEOS) 109 #if !defined(OS_CHROMEOS)
109 TEST_F(MessageCenterSettingsControllerTest, NotifierGroups) { 110 TEST_F(MessageCenterSettingsControllerTest, NotifierGroups) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 SwitchActiveUser("Profile-1"); 156 SwitchActiveUser("Profile-1");
156 EXPECT_EQ(controller()->GetNotifierGroupCount(), 1u); 157 EXPECT_EQ(controller()->GetNotifierGroupCount(), 1u);
157 EXPECT_EQ(controller()->GetNotifierGroupAt(0).name, 158 EXPECT_EQ(controller()->GetNotifierGroupAt(0).name,
158 base::UTF8ToUTF16("Profile-1")); 159 base::UTF8ToUTF16("Profile-1"));
159 EXPECT_EQ(controller()->GetNotifierGroupAt(0).index, 0u); 160 EXPECT_EQ(controller()->GetNotifierGroupAt(0).index, 0u);
160 } 161 }
161 #endif 162 #endif
162 163
163 // TODO(mukai): write a test case to reproduce the actual guest session scenario 164 // TODO(mukai): write a test case to reproduce the actual guest session scenario
164 // in ChromeOS -- no profiles in the profile_info_cache. 165 // in ChromeOS -- no profiles in the profile_info_cache.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698