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

Unified Diff: chrome/browser/chromeos/login/fake_user_manager.cc

Issue 286933002: [cros login] Split login related classes into subfolders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix includes in new tests Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/fake_user_manager.cc
diff --git a/chrome/browser/chromeos/login/fake_user_manager.cc b/chrome/browser/chromeos/login/fake_user_manager.cc
deleted file mode 100644
index b3778da2a17d21d2f3bd918d51f1edba4fb66953..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/login/fake_user_manager.cc
+++ /dev/null
@@ -1,299 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/chromeos/login/fake_user_manager.h"
-
-#include "chrome/browser/chromeos/login/fake_supervised_user_manager.h"
-
-namespace {
-
-// As defined in /chromeos/dbus/cryptohome_client.cc.
-static const char kUserIdHashSuffix[] = "-hash";
-
-} // namespace
-
-namespace chromeos {
-
-FakeUserManager::FakeUserManager()
- : supervised_user_manager_(new FakeSupervisedUserManager),
- primary_user_(NULL) {}
-
-FakeUserManager::~FakeUserManager() {
- // Can't use STLDeleteElements because of the private destructor of User.
- for (UserList::iterator it = user_list_.begin(); it != user_list_.end();
- it = user_list_.erase(it)) {
- delete *it;
- }
-}
-
-const User* FakeUserManager::AddUser(const std::string& email) {
- User* user = User::CreateRegularUser(email);
- user->set_username_hash(email + kUserIdHashSuffix);
- user->SetStubImage(User::kProfileImageIndex, false);
- user_list_.push_back(user);
- return user;
-}
-
-void FakeUserManager::AddKioskAppUser(const std::string& kiosk_app_username) {
- User* user = User::CreateKioskAppUser(kiosk_app_username);
- user->set_username_hash(kiosk_app_username + kUserIdHashSuffix);
- user_list_.push_back(user);
-}
-
-void FakeUserManager::LoginUser(const std::string& email) {
- UserLoggedIn(email, email + kUserIdHashSuffix, false);
-}
-
-void FakeUserManager::SetProfileForUser(const User* user, Profile* profile) {
- user_to_profile_[user] = profile;
-}
-
-const UserList& FakeUserManager::GetUsers() const {
- return user_list_;
-}
-
-UserList FakeUserManager::GetUsersAdmittedForMultiProfile() const {
- UserList result;
- for (UserList::const_iterator it = user_list_.begin();
- it != user_list_.end();
- ++it) {
- if ((*it)->GetType() == User::USER_TYPE_REGULAR && !(*it)->is_logged_in())
- result.push_back(*it);
- }
- return result;
-}
-
-const UserList& FakeUserManager::GetLoggedInUsers() const {
- return logged_in_users_;
-}
-
-void FakeUserManager::UserLoggedIn(const std::string& email,
- const std::string& username_hash,
- bool browser_restart) {
- for (UserList::const_iterator it = user_list_.begin();
- it != user_list_.end();
- ++it) {
- if ((*it)->username_hash() == username_hash) {
- (*it)->set_is_logged_in(true);
- logged_in_users_.push_back(*it);
-
- if (!primary_user_)
- primary_user_ = *it;
- break;
- }
- }
-}
-
-User* FakeUserManager::GetActiveUserInternal() const {
- if (user_list_.size()) {
- if (!active_user_id_.empty()) {
- for (UserList::const_iterator it = user_list_.begin();
- it != user_list_.end(); ++it) {
- if ((*it)->email() == active_user_id_)
- return *it;
- }
- }
- return user_list_[0];
- }
- return NULL;
-}
-
-const User* FakeUserManager::GetActiveUser() const {
- return GetActiveUserInternal();
-}
-
-User* FakeUserManager::GetActiveUser() {
- return GetActiveUserInternal();
-}
-
-void FakeUserManager::SwitchActiveUser(const std::string& email) {
- active_user_id_ = email;
-}
-
-void FakeUserManager::SaveUserDisplayName(
- const std::string& username,
- const base::string16& display_name) {
- for (UserList::iterator it = user_list_.begin();
- it != user_list_.end(); ++it) {
- if ((*it)->email() == username) {
- (*it)->set_display_name(display_name);
- return;
- }
- }
-}
-
-MultiProfileUserController* FakeUserManager::GetMultiProfileUserController() {
- return NULL;
-}
-
-SupervisedUserManager* FakeUserManager::GetSupervisedUserManager() {
- return supervised_user_manager_.get();
-}
-
-UserImageManager* FakeUserManager::GetUserImageManager(
- const std::string& /* user_id */) {
- return NULL;
-}
-
-const UserList& FakeUserManager::GetLRULoggedInUsers() {
- return user_list_;
-}
-
-UserList FakeUserManager::GetUnlockUsers() const {
- return user_list_;
-}
-
-const std::string& FakeUserManager::GetOwnerEmail() {
- return owner_email_;
-}
-
-bool FakeUserManager::IsKnownUser(const std::string& email) const {
- return true;
-}
-
-const User* FakeUserManager::FindUser(const std::string& email) const {
- return NULL;
-}
-
-User* FakeUserManager::FindUserAndModify(const std::string& email) {
- return NULL;
-}
-
-const User* FakeUserManager::GetLoggedInUser() const {
- return NULL;
-}
-
-User* FakeUserManager::GetLoggedInUser() {
- return NULL;
-}
-
-const User* FakeUserManager::GetPrimaryUser() const {
- return primary_user_;
-}
-
-User* FakeUserManager::GetUserByProfile(Profile* profile) const {
- const std::string& user_name = profile->GetProfileName();
- for (UserList::const_iterator it = user_list_.begin();
- it != user_list_.end(); ++it) {
- if ((*it)->email() == user_name)
- return *it;
- }
- return primary_user_;
-}
-
-Profile* FakeUserManager::GetProfileByUser(const User* user) const {
- std::map<const User*, Profile*>::const_iterator it =
- user_to_profile_.find(user);
- return it == user_to_profile_.end() ? NULL : it->second;
-}
-
-base::string16 FakeUserManager::GetUserDisplayName(
- const std::string& username) const {
- return base::string16();
-}
-
-std::string FakeUserManager::GetUserDisplayEmail(
- const std::string& username) const {
- return std::string();
-}
-
-bool FakeUserManager::IsCurrentUserOwner() const {
- return false;
-}
-
-bool FakeUserManager::IsCurrentUserNew() const {
- return false;
-}
-
-bool FakeUserManager::IsCurrentUserNonCryptohomeDataEphemeral() const {
- return false;
-}
-
-bool FakeUserManager::CanCurrentUserLock() const {
- return false;
-}
-
-bool FakeUserManager::IsUserLoggedIn() const {
- return logged_in_users_.size() > 0;
-}
-
-bool FakeUserManager::IsLoggedInAsRegularUser() const {
- return true;
-}
-
-bool FakeUserManager::IsLoggedInAsDemoUser() const {
- return false;
-}
-
-bool FakeUserManager::IsLoggedInAsPublicAccount() const {
- return false;
-}
-
-bool FakeUserManager::IsLoggedInAsGuest() const {
- return false;
-}
-
-bool FakeUserManager::IsLoggedInAsLocallyManagedUser() const {
- return false;
-}
-
-bool FakeUserManager::IsLoggedInAsKioskApp() const {
- const User* active_user = GetActiveUser();
- return active_user ?
- active_user->GetType() == User::USER_TYPE_KIOSK_APP :
- false;
-}
-
-bool FakeUserManager::IsLoggedInAsStub() const {
- return false;
-}
-
-bool FakeUserManager::IsSessionStarted() const {
- return false;
-}
-
-bool FakeUserManager::UserSessionsRestored() const {
- return false;
-}
-
-bool FakeUserManager::HasBrowserRestarted() const {
- return false;
-}
-
-bool FakeUserManager::IsUserNonCryptohomeDataEphemeral(
- const std::string& email) const {
- return false;
-}
-
-UserFlow* FakeUserManager::GetCurrentUserFlow() const {
- return NULL;
-}
-
-UserFlow* FakeUserManager::GetUserFlow(const std::string& email) const {
- return NULL;
-}
-
-bool FakeUserManager::GetAppModeChromeClientOAuthInfo(
- std::string* chrome_client_id,
- std::string* chrome_client_secret) {
- return false;
-}
-
-bool FakeUserManager::AreLocallyManagedUsersAllowed() const {
- return true;
-}
-
-base::FilePath FakeUserManager::GetUserProfileDir(
- const std::string&email) const {
- return base::FilePath();
-}
-
-bool FakeUserManager::RespectLocalePreference(
- Profile* profile,
- const User* user,
- scoped_ptr<locale_util::SwitchLanguageCallback> callback) const {
- return false;
-}
-
-} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/fake_user_manager.h ('k') | chrome/browser/chromeos/login/help_app_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698