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

Unified Diff: chrome/browser/chromeos/login/mock_authenticator.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/mock_authenticator.cc
diff --git a/chrome/browser/chromeos/login/mock_authenticator.cc b/chrome/browser/chromeos/login/mock_authenticator.cc
deleted file mode 100644
index 06211f9c220af7659015abdbbbce37e4d4903251..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/login/mock_authenticator.cc
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (c) 2012 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/mock_authenticator.h"
-
-#include "base/bind.h"
-#include "chrome/browser/chromeos/login/user.h"
-#include "content/public/browser/browser_thread.h"
-
-using content::BrowserThread;
-
-namespace chromeos {
-
-void MockAuthenticator::AuthenticateToLogin(Profile* profile,
- const UserContext& user_context) {
- if (expected_username_ == user_context.GetUserID() &&
- expected_password_ == user_context.GetPassword()) {
- BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- base::Bind(&MockAuthenticator::OnLoginSuccess, this));
- return;
- }
- GoogleServiceAuthError error(
- GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
- BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- base::Bind(&MockAuthenticator::OnLoginFailure, this,
- LoginFailure::FromNetworkAuthFailure(error)));
-}
-
-void MockAuthenticator::CompleteLogin(Profile* profile,
- const UserContext& user_context) {
- CHECK_EQ(expected_username_, user_context.GetUserID());
- CHECK_EQ(expected_password_, user_context.GetPassword());
- OnLoginSuccess();
-}
-
-void MockAuthenticator::AuthenticateToUnlock(
- const UserContext& user_context) {
- AuthenticateToLogin(NULL /* not used */, user_context);
-}
-
-void MockAuthenticator::LoginAsLocallyManagedUser(
- const UserContext& user_context) {
- consumer_->OnLoginSuccess(UserContext(expected_username_,
- std::string(),
- std::string(),
- user_context.GetUserID())); // hash
-}
-
-void MockAuthenticator::LoginRetailMode() {
- consumer_->OnRetailModeLoginSuccess(UserContext("demo-mode",
- std::string(),
- std::string(),
- "demo-mode"));
-}
-
-void MockAuthenticator::LoginAsPublicAccount(const std::string& username) {
- consumer_->OnLoginSuccess(UserContext(expected_username_,
- std::string(),
- std::string(),
- expected_username_));
-}
-
-void MockAuthenticator::LoginAsKioskAccount(const std::string& app_user_id,
- bool use_guest_mount) {
- consumer_->OnLoginSuccess(UserContext(expected_username_,
- std::string(),
- std::string(),
- expected_username_));
-}
-
-void MockAuthenticator::LoginOffTheRecord() {
- consumer_->OnOffTheRecordLoginSuccess();
-}
-
-void MockAuthenticator::OnRetailModeLoginSuccess() {
- consumer_->OnRetailModeLoginSuccess(UserContext(expected_username_,
- std::string(),
- std::string(),
- expected_username_));
-}
-
-void MockAuthenticator::OnLoginSuccess() {
- // If we want to be more like the real thing, we could save username
- // in AuthenticateToLogin, but there's not much of a point.
- consumer_->OnLoginSuccess(UserContext(expected_username_,
- expected_password_,
- std::string(),
- expected_username_));
-}
-
-void MockAuthenticator::OnLoginFailure(const LoginFailure& failure) {
- consumer_->OnLoginFailure(failure);
-}
-
-void MockAuthenticator::SetExpectedCredentials(
- const std::string& expected_username,
- const std::string& expected_password) {
- expected_username_ = expected_username;
- expected_password_ = expected_password;
-}
-
-} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/mock_authenticator.h ('k') | chrome/browser/chromeos/login/mock_login_display.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698