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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/signin_userlist_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 "base/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" 6 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h"
7 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" 7 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
8 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" 8 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h"
9 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller_dele gate.h" 9 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller_dele gate.h"
10 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 10 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
11 #include "chrome/browser/signin/screenlock_bridge.h" 11 #include "chrome/browser/signin/screenlock_bridge.h"
12 #include "chrome/test/base/testing_browser_process.h" 12 #include "chrome/test/base/testing_browser_process.h"
13 #include "chrome/test/base/testing_profile_manager.h" 13 #include "chrome/test/base/testing_profile_manager.h"
14 #include "components/user_manager/user.h" 14 #include "components/user_manager/user.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace { 17 namespace {
(...skipping 10 matching lines...) Expand all
28 28
29 } // namespace 29 } // namespace
30 30
31 namespace chromeos { 31 namespace chromeos {
32 32
33 class SigninPrepareUserListTest 33 class SigninPrepareUserListTest
34 : public testing::Test, 34 : public testing::Test,
35 public MultiProfileUserControllerDelegate { 35 public MultiProfileUserControllerDelegate {
36 public: 36 public:
37 SigninPrepareUserListTest() 37 SigninPrepareUserListTest()
38 : fake_user_manager_(new FakeUserManager()), 38 : fake_user_manager_(new FakeChromeUserManager()),
39 user_manager_enabler_(fake_user_manager_) { 39 user_manager_enabler_(fake_user_manager_) {}
40 }
41 40
42 ~SigninPrepareUserListTest() override {} 41 ~SigninPrepareUserListTest() override {}
43 42
44 void SetUp() override { 43 void SetUp() override {
45 profile_manager_.reset( 44 profile_manager_.reset(
46 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); 45 new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
47 ASSERT_TRUE(profile_manager_->SetUp()); 46 ASSERT_TRUE(profile_manager_->SetUp());
48 controller_.reset(new MultiProfileUserController( 47 controller_.reset(new MultiProfileUserController(
49 this, TestingBrowserProcess::GetGlobal()->local_state())); 48 this, TestingBrowserProcess::GetGlobal()->local_state()));
50 fake_user_manager_->set_multi_profile_user_controller(controller_.get()); 49 fake_user_manager_->set_multi_profile_user_controller(controller_.get());
51 50
52 for (size_t i = 0; i < arraysize(kUsersPublic); ++i) 51 for (size_t i = 0; i < arraysize(kUsersPublic); ++i)
53 fake_user_manager_->AddPublicAccountUser(kUsersPublic[i]); 52 fake_user_manager_->AddPublicAccountUser(kUsersPublic[i]);
54 53
55 for (size_t i = 0; i < arraysize(kUsers); ++i) 54 for (size_t i = 0; i < arraysize(kUsers); ++i)
56 fake_user_manager_->AddUser(kUsers[i]); 55 fake_user_manager_->AddUser(kUsers[i]);
57 56
58 fake_user_manager_->set_owner_email(kOwner); 57 fake_user_manager_->set_owner_email(kOwner);
59 } 58 }
60 59
61 void TearDown() override { 60 void TearDown() override {
62 controller_.reset(); 61 controller_.reset();
63 profile_manager_.reset(); 62 profile_manager_.reset();
64 } 63 }
65 64
66 // MultiProfileUserControllerDelegate overrides: 65 // MultiProfileUserControllerDelegate overrides:
67 void OnUserNotAllowed(const std::string& user_email) override {} 66 void OnUserNotAllowed(const std::string& user_email) override {}
68 67
69 FakeUserManager* fake_user_manager_; 68 FakeChromeUserManager* fake_user_manager_;
70 ScopedUserManagerEnabler user_manager_enabler_; 69 ScopedUserManagerEnabler user_manager_enabler_;
71 scoped_ptr<TestingProfileManager> profile_manager_; 70 scoped_ptr<TestingProfileManager> profile_manager_;
72 std::map<std::string, 71 std::map<std::string,
73 ScreenlockBridge::LockHandler::AuthType> user_auth_type_map; 72 ScreenlockBridge::LockHandler::AuthType> user_auth_type_map;
74 scoped_ptr<MultiProfileUserController> controller_; 73 scoped_ptr<MultiProfileUserController> controller_;
75 74
76 DISALLOW_COPY_AND_ASSIGN(SigninPrepareUserListTest); 75 DISALLOW_COPY_AND_ASSIGN(SigninPrepareUserListTest);
77 }; 76 };
78 77
79 TEST_F(SigninPrepareUserListTest, AlwaysKeepOwnerInList) { 78 TEST_F(SigninPrepareUserListTest, AlwaysKeepOwnerInList) {
(...skipping 28 matching lines...) Expand all
108 users_to_send = UserSelectionScreen::PrepareUserListForSending( 107 users_to_send = UserSelectionScreen::PrepareUserListForSending(
109 fake_user_manager_->GetUsers(), 108 fake_user_manager_->GetUsers(),
110 kOwner, 109 kOwner,
111 false /* is signin to add */); 110 false /* is signin to add */);
112 111
113 EXPECT_EQ(kMaxUsers, users_to_send.size()); 112 EXPECT_EQ(kMaxUsers, users_to_send.size());
114 EXPECT_EQ("public0@gmail.com", users_to_send.front()->email()); 113 EXPECT_EQ("public0@gmail.com", users_to_send.front()->email());
115 } 114 }
116 115
117 } // namespace chromeos 116 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698