Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: chrome/browser/chromeos/login/users/fake_user_manager.cc

Issue 369833002: Tests added for user-listing on sign-in screen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/chromeos/login/users/fake_user_manager.h" 5 #include "chrome/browser/chromeos/login/users/fake_user_manager.h"
6 6
7 #include "chrome/browser/chromeos/login/users/fake_supervised_user_manager.h" 7 #include "chrome/browser/chromeos/login/users/fake_supervised_user_manager.h"
8 #include "chrome/browser/chromeos/profiles/profile_helper.h" 8 #include "chrome/browser/chromeos/profiles/profile_helper.h"
9 9
10 namespace { 10 namespace {
(...skipping 24 matching lines...) Expand all
35 35
36 const User* FakeUserManager::AddUser(const std::string& email) { 36 const User* FakeUserManager::AddUser(const std::string& email) {
37 User* user = User::CreateRegularUser(email); 37 User* user = User::CreateRegularUser(email);
38 user->set_username_hash(email + kUserIdHashSuffix); 38 user->set_username_hash(email + kUserIdHashSuffix);
39 user->SetStubImage(User::kProfileImageIndex, false); 39 user->SetStubImage(User::kProfileImageIndex, false);
40 user_list_.push_back(user); 40 user_list_.push_back(user);
41 ProfileHelper::Get()->SetProfileToUserMappingForTesting(user); 41 ProfileHelper::Get()->SetProfileToUserMappingForTesting(user);
42 return user; 42 return user;
43 } 43 }
44 44
45 const User* FakeUserManager::AddPublicAccountUser(const std::string& email) {
46 User* user = User::CreatePublicAccountUser(email);
47 user->set_username_hash(email + kUserIdHashSuffix);
48 user->SetStubImage(User::kProfileImageIndex, false);
49 user_list_.push_back(user);
50 ProfileHelper::Get()->SetProfileToUserMappingForTesting(user);
51 return user;
52 }
53
45 void FakeUserManager::AddKioskAppUser(const std::string& kiosk_app_username) { 54 void FakeUserManager::AddKioskAppUser(const std::string& kiosk_app_username) {
46 User* user = User::CreateKioskAppUser(kiosk_app_username); 55 User* user = User::CreateKioskAppUser(kiosk_app_username);
47 user->set_username_hash(kiosk_app_username + kUserIdHashSuffix); 56 user->set_username_hash(kiosk_app_username + kUserIdHashSuffix);
48 user_list_.push_back(user); 57 user_list_.push_back(user);
49 ProfileHelper::Get()->SetProfileToUserMappingForTesting(user); 58 ProfileHelper::Get()->SetProfileToUserMappingForTesting(user);
50 } 59 }
51 60
61 void FakeUserManager::RemoveUserFromList(const std::string& email) {
62 UserList::iterator it = user_list_.begin();
63 while (it != user_list_.end() && (*it)->email() != email) ++it;
64 if (it != user_list_.end()) {
65 user_list_.erase(it);
66 }
67 }
68
52 void FakeUserManager::LoginUser(const std::string& email) { 69 void FakeUserManager::LoginUser(const std::string& email) {
53 UserLoggedIn(email, email + kUserIdHashSuffix, false); 70 UserLoggedIn(email, email + kUserIdHashSuffix, false);
54 } 71 }
55 72
56 const UserList& FakeUserManager::GetUsers() const { 73 const UserList& FakeUserManager::GetUsers() const {
57 return user_list_; 74 return user_list_;
58 } 75 }
59 76
60 UserList FakeUserManager::GetUsersAdmittedForMultiProfile() const { 77 UserList FakeUserManager::GetUsersAdmittedForMultiProfile() const {
61 UserList result; 78 UserList result;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 278
262 UserFlow* FakeUserManager::GetUserFlow(const std::string& email) const { 279 UserFlow* FakeUserManager::GetUserFlow(const std::string& email) const {
263 return NULL; 280 return NULL;
264 } 281 }
265 282
266 bool FakeUserManager::AreLocallyManagedUsersAllowed() const { 283 bool FakeUserManager::AreLocallyManagedUsersAllowed() const {
267 return true; 284 return true;
268 } 285 }
269 286
270 } // namespace chromeos 287 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698