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_chrome_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" | |
12 #include "chrome/test/base/testing_browser_process.h" | 11 #include "chrome/test/base/testing_browser_process.h" |
13 #include "chrome/test/base/testing_profile_manager.h" | 12 #include "chrome/test/base/testing_profile_manager.h" |
| 13 #include "components/proximity_auth/screenlock_bridge.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 { |
18 | 18 |
19 const size_t kMaxUsers = 18; // same as in user_selection_screen.cc | 19 const size_t kMaxUsers = 18; // same as in user_selection_screen.cc |
20 const char* kOwner = "owner@gmail.com"; | 20 const char* kOwner = "owner@gmail.com"; |
21 const char* kUsersPublic[] = {"public0@gmail.com", "public1@gmail.com"}; | 21 const char* kUsersPublic[] = {"public0@gmail.com", "public1@gmail.com"}; |
22 const char* kUsers[] = { | 22 const char* kUsers[] = { |
23 "a0@gmail.com", "a1@gmail.com", "a2@gmail.com", "a3@gmail.com", | 23 "a0@gmail.com", "a1@gmail.com", "a2@gmail.com", "a3@gmail.com", |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 controller_.reset(); | 61 controller_.reset(); |
62 profile_manager_.reset(); | 62 profile_manager_.reset(); |
63 } | 63 } |
64 | 64 |
65 // MultiProfileUserControllerDelegate overrides: | 65 // MultiProfileUserControllerDelegate overrides: |
66 void OnUserNotAllowed(const std::string& user_email) override {} | 66 void OnUserNotAllowed(const std::string& user_email) override {} |
67 | 67 |
68 FakeChromeUserManager* fake_user_manager_; | 68 FakeChromeUserManager* fake_user_manager_; |
69 ScopedUserManagerEnabler user_manager_enabler_; | 69 ScopedUserManagerEnabler user_manager_enabler_; |
70 scoped_ptr<TestingProfileManager> profile_manager_; | 70 scoped_ptr<TestingProfileManager> profile_manager_; |
71 std::map<std::string, | 71 std::map<std::string, proximity_auth::ScreenlockBridge::LockHandler::AuthType> |
72 ScreenlockBridge::LockHandler::AuthType> user_auth_type_map; | 72 user_auth_type_map; |
73 scoped_ptr<MultiProfileUserController> controller_; | 73 scoped_ptr<MultiProfileUserController> controller_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(SigninPrepareUserListTest); | 75 DISALLOW_COPY_AND_ASSIGN(SigninPrepareUserListTest); |
76 }; | 76 }; |
77 | 77 |
78 TEST_F(SigninPrepareUserListTest, AlwaysKeepOwnerInList) { | 78 TEST_F(SigninPrepareUserListTest, AlwaysKeepOwnerInList) { |
79 EXPECT_LT(kMaxUsers, fake_user_manager_->GetUsers().size()); | 79 EXPECT_LT(kMaxUsers, fake_user_manager_->GetUsers().size()); |
80 user_manager::UserList users_to_send = | 80 user_manager::UserList users_to_send = |
81 UserSelectionScreen::PrepareUserListForSending( | 81 UserSelectionScreen::PrepareUserListForSending( |
82 fake_user_manager_->GetUsers(), kOwner, true /* is signin to add */); | 82 fake_user_manager_->GetUsers(), kOwner, true /* is signin to add */); |
(...skipping 24 matching lines...) Expand all Loading... |
107 users_to_send = UserSelectionScreen::PrepareUserListForSending( | 107 users_to_send = UserSelectionScreen::PrepareUserListForSending( |
108 fake_user_manager_->GetUsers(), | 108 fake_user_manager_->GetUsers(), |
109 kOwner, | 109 kOwner, |
110 false /* is signin to add */); | 110 false /* is signin to add */); |
111 | 111 |
112 EXPECT_EQ(kMaxUsers, users_to_send.size()); | 112 EXPECT_EQ(kMaxUsers, users_to_send.size()); |
113 EXPECT_EQ("public0@gmail.com", users_to_send.front()->email()); | 113 EXPECT_EQ("public0@gmail.com", users_to_send.front()->email()); |
114 } | 114 } |
115 | 115 |
116 } // namespace chromeos | 116 } // namespace chromeos |
OLD | NEW |