Home | History | Annotate | Download | only in login
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/chromeos/login/test_attempt_state.h"
      6 
      7 #include <string>
      8 
      9 #include "google_apis/gaia/gaia_auth_consumer.h"
     10 
     11 namespace chromeos {
     12 
     13 TestAttemptState::TestAttemptState(const UserContext& credentials,
     14                                    const std::string& login_token,
     15                                    const std::string& login_captcha,
     16                                    const User::UserType user_type,
     17                                    const bool user_is_new)
     18     : AuthAttemptState(credentials,
     19                        login_token,
     20                        login_captcha,
     21                        user_type,
     22                        user_is_new) {
     23 }
     24 
     25 TestAttemptState::~TestAttemptState() {}
     26 
     27 void TestAttemptState::PresetOnlineLoginStatus(
     28     const LoginFailure& outcome) {
     29   online_complete_ = true;
     30   online_outcome_ = outcome;
     31 }
     32 
     33 void TestAttemptState::DisableHosted() {
     34   hosted_policy_ = GaiaAuthFetcher::HostedAccountsNotAllowed;
     35 }
     36 
     37 void TestAttemptState::PresetCryptohomeStatus(
     38     bool cryptohome_outcome,
     39     cryptohome::MountError cryptohome_code) {
     40   cryptohome_complete_ = true;
     41   cryptohome_outcome_ = cryptohome_outcome;
     42   cryptohome_code_ = cryptohome_code;
     43 }
     44 
     45 bool TestAttemptState::online_complete() {
     46   return online_complete_;
     47 }
     48 
     49 const LoginFailure& TestAttemptState::online_outcome() {
     50   return online_outcome_;
     51 }
     52 
     53 bool TestAttemptState::is_first_time_user() {
     54   return is_first_time_user_;
     55 }
     56 
     57 GaiaAuthFetcher::HostedAccountsSetting TestAttemptState::hosted_policy() {
     58   return hosted_policy_;
     59 }
     60 
     61 bool TestAttemptState::cryptohome_complete() {
     62   return cryptohome_complete_;
     63 }
     64 
     65 bool TestAttemptState::cryptohome_outcome() {
     66   return cryptohome_outcome_;
     67 }
     68 
     69 cryptohome::MountError TestAttemptState::cryptohome_code() {
     70   return cryptohome_code_;
     71 }
     72 
     73 }  // namespace chromeos
     74