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