| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/fake_chrome_user_manager.h" | 5 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
| 10 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 10 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 account_id.GetUserEmail())); | 51 account_id.GetUserEmail())); |
| 52 user->SetStubImage(base::WrapUnique(new user_manager::UserImage( | 52 user->SetStubImage(base::WrapUnique(new user_manager::UserImage( |
| 53 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 53 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 54 IDR_PROFILE_PICTURE_LOADING))), | 54 IDR_PROFILE_PICTURE_LOADING))), |
| 55 user_manager::User::USER_IMAGE_PROFILE, false); | 55 user_manager::User::USER_IMAGE_PROFILE, false); |
| 56 users_.push_back(user); | 56 users_.push_back(user); |
| 57 chromeos::ProfileHelper::Get()->SetProfileToUserMappingForTesting(user); | 57 chromeos::ProfileHelper::Get()->SetProfileToUserMappingForTesting(user); |
| 58 return user; | 58 return user; |
| 59 } | 59 } |
| 60 | 60 |
| 61 user_manager::User* FakeChromeUserManager::AddKioskAppUser( |
| 62 const AccountId& account_id) { |
| 63 user_manager::User* user = user_manager::User::CreateKioskAppUser(account_id); |
| 64 user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( |
| 65 account_id.GetUserEmail())); |
| 66 users_.push_back(user); |
| 67 return user; |
| 68 } |
| 69 |
| 61 const user_manager::User* FakeChromeUserManager::AddPublicAccountUser( | 70 const user_manager::User* FakeChromeUserManager::AddPublicAccountUser( |
| 62 const AccountId& account_id) { | 71 const AccountId& account_id) { |
| 63 user_manager::User* user = | 72 user_manager::User* user = |
| 64 user_manager::User::CreatePublicAccountUser(account_id); | 73 user_manager::User::CreatePublicAccountUser(account_id); |
| 65 user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( | 74 user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( |
| 66 account_id.GetUserEmail())); | 75 account_id.GetUserEmail())); |
| 67 user->SetStubImage(base::WrapUnique(new user_manager::UserImage( | 76 user->SetStubImage(base::WrapUnique(new user_manager::UserImage( |
| 68 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 77 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 69 IDR_PROFILE_PICTURE_LOADING))), | 78 IDR_PROFILE_PICTURE_LOADING))), |
| 70 user_manager::User::USER_IMAGE_PROFILE, false); | 79 user_manager::User::USER_IMAGE_PROFILE, false); |
| 71 users_.push_back(user); | 80 users_.push_back(user); |
| 72 return user; | 81 return user; |
| 73 } | 82 } |
| 74 | 83 |
| 75 void FakeChromeUserManager::AddKioskAppUser( | |
| 76 const AccountId& kiosk_app_account_id) { | |
| 77 user_manager::User* user = | |
| 78 user_manager::User::CreateKioskAppUser(kiosk_app_account_id); | |
| 79 user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( | |
| 80 kiosk_app_account_id.GetUserEmail())); | |
| 81 users_.push_back(user); | |
| 82 } | |
| 83 | |
| 84 void FakeChromeUserManager::LoginUser(const AccountId& account_id) { | 84 void FakeChromeUserManager::LoginUser(const AccountId& account_id) { |
| 85 UserLoggedIn(account_id, ProfileHelper::GetUserIdHashByUserIdForTesting( | 85 UserLoggedIn(account_id, ProfileHelper::GetUserIdHashByUserIdForTesting( |
| 86 account_id.GetUserEmail()), | 86 account_id.GetUserEmail()), |
| 87 false /* browser_restart */); | 87 false /* browser_restart */); |
| 88 } | 88 } |
| 89 | 89 |
| 90 BootstrapManager* FakeChromeUserManager::GetBootstrapManager() { | 90 BootstrapManager* FakeChromeUserManager::GetBootstrapManager() { |
| 91 return bootstrap_manager_; | 91 return bootstrap_manager_; |
| 92 } | 92 } |
| 93 | 93 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 NOTIMPLEMENTED(); | 268 NOTIMPLEMENTED(); |
| 269 return; | 269 return; |
| 270 } | 270 } |
| 271 | 271 |
| 272 bool FakeChromeUserManager::IsValidDefaultUserImageId(int image_index) const { | 272 bool FakeChromeUserManager::IsValidDefaultUserImageId(int image_index) const { |
| 273 NOTIMPLEMENTED(); | 273 NOTIMPLEMENTED(); |
| 274 return false; | 274 return false; |
| 275 } | 275 } |
| 276 | 276 |
| 277 } // namespace chromeos | 277 } // namespace chromeos |
| OLD | NEW |