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

Side by Side Diff: chrome/browser/chromeos/login/users/multi_profile_user_controller_unittest.cc

Issue 824683002: UserManager stack refactoring. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test fixed. Created 5 years, 10 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
OLDNEW
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 "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" 5 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" 10 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
11 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller_dele gate.h" 11 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller_dele gate.h"
12 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 12 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
13 #include "chrome/browser/chromeos/policy/policy_cert_service.h" 13 #include "chrome/browser/chromeos/policy/policy_cert_service.h"
14 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" 14 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
15 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" 15 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h"
16 #include "chrome/browser/chromeos/profiles/profile_helper.h" 16 #include "chrome/browser/chromeos/profiles/profile_helper.h"
17 #include "chrome/browser/prefs/browser_prefs.h" 17 #include "chrome/browser/prefs/browser_prefs.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "chrome/test/base/scoped_testing_local_state.h" 19 #include "chrome/test/base/scoped_testing_local_state.h"
20 #include "chrome/test/base/testing_browser_process.h" 20 #include "chrome/test/base/testing_browser_process.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 user_manager::UserManager::Get()).release(); 107 user_manager::UserManager::Get()).release();
108 } 108 }
109 109
110 } // namespace 110 } // namespace
111 111
112 class MultiProfileUserControllerTest 112 class MultiProfileUserControllerTest
113 : public testing::Test, 113 : public testing::Test,
114 public MultiProfileUserControllerDelegate { 114 public MultiProfileUserControllerDelegate {
115 public: 115 public:
116 MultiProfileUserControllerTest() 116 MultiProfileUserControllerTest()
117 : fake_user_manager_(new FakeUserManager), 117 : fake_user_manager_(new FakeChromeUserManager),
118 user_manager_enabler_(fake_user_manager_), 118 user_manager_enabler_(fake_user_manager_),
119 user_not_allowed_count_(0) {} 119 user_not_allowed_count_(0) {}
120 ~MultiProfileUserControllerTest() override {} 120 ~MultiProfileUserControllerTest() override {}
121 121
122 void SetUp() override { 122 void SetUp() override {
123 profile_manager_.reset( 123 profile_manager_.reset(
124 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); 124 new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
125 ASSERT_TRUE(profile_manager_->SetUp()); 125 ASSERT_TRUE(profile_manager_->SetUp());
126 controller_.reset(new MultiProfileUserController( 126 controller_.reset(new MultiProfileUserController(
127 this, TestingBrowserProcess::GetGlobal()->local_state())); 127 this, TestingBrowserProcess::GetGlobal()->local_state()));
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 MultiProfileUserController* controller() { return controller_.get(); } 196 MultiProfileUserController* controller() { return controller_.get(); }
197 int user_not_allowed_count() const { return user_not_allowed_count_; } 197 int user_not_allowed_count() const { return user_not_allowed_count_; }
198 198
199 TestingProfile* profile(int index) { 199 TestingProfile* profile(int index) {
200 return user_profiles_[index]; 200 return user_profiles_[index];
201 } 201 }
202 202
203 content::TestBrowserThreadBundle threads_; 203 content::TestBrowserThreadBundle threads_;
204 scoped_ptr<policy::PolicyCertVerifier> cert_verifier_; 204 scoped_ptr<policy::PolicyCertVerifier> cert_verifier_;
205 scoped_ptr<TestingProfileManager> profile_manager_; 205 scoped_ptr<TestingProfileManager> profile_manager_;
206 FakeUserManager* fake_user_manager_; // Not owned 206 FakeChromeUserManager* fake_user_manager_; // Not owned
207 ScopedUserManagerEnabler user_manager_enabler_; 207 ScopedUserManagerEnabler user_manager_enabler_;
208 208
209 scoped_ptr<MultiProfileUserController> controller_; 209 scoped_ptr<MultiProfileUserController> controller_;
210 210
211 std::vector<TestingProfile*> user_profiles_; 211 std::vector<TestingProfile*> user_profiles_;
212 212
213 int user_not_allowed_count_; 213 int user_not_allowed_count_;
214 214
215 private: 215 private:
216 DISALLOW_COPY_AND_ASSIGN(MultiProfileUserControllerTest); 216 DISALLOW_COPY_AND_ASSIGN(MultiProfileUserControllerTest);
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 EXPECT_EQ(MultiProfileUserController::NOT_ALLOWED_PRIMARY_POLICY_CERT_TAINTED, 438 EXPECT_EQ(MultiProfileUserController::NOT_ALLOWED_PRIMARY_POLICY_CERT_TAINTED,
439 reason); 439 reason);
440 EXPECT_EQ(MultiProfileUserController::NOT_ALLOWED_PRIMARY_POLICY_CERT_TAINTED, 440 EXPECT_EQ(MultiProfileUserController::NOT_ALLOWED_PRIMARY_POLICY_CERT_TAINTED,
441 MultiProfileUserController::GetPrimaryUserPolicy()); 441 MultiProfileUserController::GetPrimaryUserPolicy());
442 442
443 // Flush tasks posted to IO. 443 // Flush tasks posted to IO.
444 base::RunLoop().RunUntilIdle(); 444 base::RunLoop().RunUntilIdle();
445 } 445 }
446 446
447 } // namespace chromeos 447 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/users/fake_user_manager.cc ('k') | chrome/browser/chromeos/login/users/user_manager_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698