This source file includes following definitions.
- AuthenticateToLogin
- CompleteLogin
- AuthenticateToUnlock
- LoginAsLocallyManagedUser
- LoginRetailMode
- LoginAsPublicAccount
- LoginAsKioskAccount
- LoginOffTheRecord
- OnRetailModeLoginSuccess
- OnLoginSuccess
- OnLoginFailure
- SetExpectedCredentials
#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.username &&
      expected_password_ == user_context.password) {
    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.username);
  CHECK_EQ(expected_password_, user_context.password);
  OnLoginSuccess();
}
void MockAuthenticator::AuthenticateToUnlock(
    const UserContext& user_context) {
  AuthenticateToLogin(NULL , user_context);
}
void MockAuthenticator::LoginAsLocallyManagedUser(
    const UserContext& user_context) {
  consumer_->OnLoginSuccess(UserContext(expected_username_,
                                        std::string(),
                                        std::string(),
                                        user_context.username)); 
}
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() {
  
  
  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;
}
}