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/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 Loading... |
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 } | 40 } |
41 | 41 |
42 ~SigninPrepareUserListTest() override {} | 42 ~SigninPrepareUserListTest() override {} |
43 | 43 |
44 void SetUp() override { | 44 void SetUp() override { |
45 profile_manager_.reset( | 45 profile_manager_.reset( |
46 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 46 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
47 ASSERT_TRUE(profile_manager_->SetUp()); | 47 ASSERT_TRUE(profile_manager_->SetUp()); |
48 controller_.reset(new MultiProfileUserController( | 48 controller_.reset(new MultiProfileUserController( |
(...skipping 10 matching lines...) Expand all Loading... |
59 } | 59 } |
60 | 60 |
61 void TearDown() override { | 61 void TearDown() override { |
62 controller_.reset(); | 62 controller_.reset(); |
63 profile_manager_.reset(); | 63 profile_manager_.reset(); |
64 } | 64 } |
65 | 65 |
66 // MultiProfileUserControllerDelegate overrides: | 66 // MultiProfileUserControllerDelegate overrides: |
67 void OnUserNotAllowed(const std::string& user_email) override {} | 67 void OnUserNotAllowed(const std::string& user_email) override {} |
68 | 68 |
69 FakeUserManager* fake_user_manager_; | 69 FakeChromeUserManager* fake_user_manager_; |
70 ScopedUserManagerEnabler user_manager_enabler_; | 70 ScopedUserManagerEnabler user_manager_enabler_; |
71 scoped_ptr<TestingProfileManager> profile_manager_; | 71 scoped_ptr<TestingProfileManager> profile_manager_; |
72 std::map<std::string, | 72 std::map<std::string, |
73 ScreenlockBridge::LockHandler::AuthType> user_auth_type_map; | 73 ScreenlockBridge::LockHandler::AuthType> user_auth_type_map; |
74 scoped_ptr<MultiProfileUserController> controller_; | 74 scoped_ptr<MultiProfileUserController> controller_; |
75 | 75 |
76 DISALLOW_COPY_AND_ASSIGN(SigninPrepareUserListTest); | 76 DISALLOW_COPY_AND_ASSIGN(SigninPrepareUserListTest); |
77 }; | 77 }; |
78 | 78 |
79 TEST_F(SigninPrepareUserListTest, AlwaysKeepOwnerInList) { | 79 TEST_F(SigninPrepareUserListTest, AlwaysKeepOwnerInList) { |
(...skipping 28 matching lines...) Expand all Loading... |
108 users_to_send = UserSelectionScreen::PrepareUserListForSending( | 108 users_to_send = UserSelectionScreen::PrepareUserListForSending( |
109 fake_user_manager_->GetUsers(), | 109 fake_user_manager_->GetUsers(), |
110 kOwner, | 110 kOwner, |
111 false /* is signin to add */); | 111 false /* is signin to add */); |
112 | 112 |
113 EXPECT_EQ(kMaxUsers, users_to_send.size()); | 113 EXPECT_EQ(kMaxUsers, users_to_send.size()); |
114 EXPECT_EQ("public0@gmail.com", users_to_send.front()->email()); | 114 EXPECT_EQ("public0@gmail.com", users_to_send.front()->email()); |
115 } | 115 } |
116 | 116 |
117 } // namespace chromeos | 117 } // namespace chromeos |
OLD | NEW |