| 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_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/signin_screen_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 { |
| 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", |
| 24 "a4@gmail.com", "a5@gmail.com", "a6@gmail.com", "a7@gmail.com", | 24 "a4@gmail.com", "a5@gmail.com", "a6@gmail.com", "a7@gmail.com", |
| 25 "a8@gmail.com", "a9@gmail.com", "a10@gmail.com", "a11@gmail.com", | 25 "a8@gmail.com", "a9@gmail.com", "a10@gmail.com", "a11@gmail.com", |
| 26 "a12@gmail.com", "a13@gmail.com", "a14@gmail.com", "a15@gmail.com", | 26 "a12@gmail.com", "a13@gmail.com", "a14@gmail.com", "a15@gmail.com", |
| 27 "a16@gmail.com", "a17@gmail.com", kOwner, "a18@gmail.com"}; | 27 "a16@gmail.com", "a17@gmail.com", kOwner, "a18@gmail.com"}; |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 // MultiProfileUserControllerDelegate overrides: | 67 // MultiProfileUserControllerDelegate overrides: |
| 68 virtual void OnUserNotAllowed(const std::string& user_email) OVERRIDE { | 68 virtual void OnUserNotAllowed(const std::string& user_email) OVERRIDE { |
| 69 } | 69 } |
| 70 | 70 |
| 71 FakeUserManager* fake_user_manager_; | 71 FakeUserManager* fake_user_manager_; |
| 72 ScopedUserManagerEnabler user_manager_enabler_; | 72 ScopedUserManagerEnabler user_manager_enabler_; |
| 73 scoped_ptr<TestingProfileManager> profile_manager_; | 73 scoped_ptr<TestingProfileManager> profile_manager_; |
| 74 std::map<std::string, | 74 std::map<std::string, |
| 75 ScreenlockBridge::LockHandler::AuthType> user_auth_type_map; | 75 SigninScreenBridge::LockHandler::AuthType> user_auth_type_map; |
| 76 scoped_ptr<MultiProfileUserController> controller_; | 76 scoped_ptr<MultiProfileUserController> controller_; |
| 77 | 77 |
| 78 private: |
| 78 DISALLOW_COPY_AND_ASSIGN(SigninPrepareUserListTest); | 79 DISALLOW_COPY_AND_ASSIGN(SigninPrepareUserListTest); |
| 79 }; | 80 }; |
| 80 | 81 |
| 81 TEST_F(SigninPrepareUserListTest, AlwaysKeepOwnerInList) { | 82 TEST_F(SigninPrepareUserListTest, AlwaysKeepOwnerInList) { |
| 82 EXPECT_LT(kMaxUsers, fake_user_manager_->GetUsers().size()); | 83 EXPECT_LT(kMaxUsers, fake_user_manager_->GetUsers().size()); |
| 83 user_manager::UserList users_to_send = | 84 user_manager::UserList users_to_send = |
| 84 UserSelectionScreen::PrepareUserListForSending( | 85 UserSelectionScreen::PrepareUserListForSending( |
| 85 fake_user_manager_->GetUsers(), kOwner, true /* is signin to add */); | 86 fake_user_manager_->GetUsers(), kOwner, true /* is signin to add */); |
| 86 | 87 |
| 87 EXPECT_EQ(kMaxUsers, users_to_send.size()); | 88 EXPECT_EQ(kMaxUsers, users_to_send.size()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 110 users_to_send = UserSelectionScreen::PrepareUserListForSending( | 111 users_to_send = UserSelectionScreen::PrepareUserListForSending( |
| 111 fake_user_manager_->GetUsers(), | 112 fake_user_manager_->GetUsers(), |
| 112 kOwner, | 113 kOwner, |
| 113 false /* is signin to add */); | 114 false /* is signin to add */); |
| 114 | 115 |
| 115 EXPECT_EQ(kMaxUsers, users_to_send.size()); | 116 EXPECT_EQ(kMaxUsers, users_to_send.size()); |
| 116 EXPECT_EQ("public0@gmail.com", users_to_send.front()->email()); | 117 EXPECT_EQ("public0@gmail.com", users_to_send.front()->email()); |
| 117 } | 118 } |
| 118 | 119 |
| 119 } // namespace chromeos | 120 } // namespace chromeos |
| OLD | NEW |