Home | History | Annotate | Download | only in auth
      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
      3 // found in the LICENSE file.
      4 
      5 #include "chromeos/login/auth/test_attempt_state.h"
      6 
      7 #include "components/user_manager/user_type.h"
      8 #include "google_apis/gaia/gaia_auth_consumer.h"
      9 
     10 namespace chromeos {
     11 
     12 TestAttemptState::TestAttemptState(const UserContext& credentials,
     13                                    const bool user_is_new)
     14     : AuthAttemptState(credentials,
     15                        user_manager::USER_TYPE_REGULAR,
     16                        false,  // unlock
     17                        false,  // online_complete
     18                        user_is_new) {
     19 }
     20 
     21 TestAttemptState::~TestAttemptState() {
     22 }
     23 
     24 void TestAttemptState::PresetOnlineLoginStatus(const AuthFailure& outcome) {
     25   online_complete_ = true;
     26   online_outcome_ = outcome;
     27 }
     28 
     29 void TestAttemptState::DisableHosted() {
     30   hosted_policy_ = GaiaAuthFetcher::HostedAccountsNotAllowed;
     31 }
     32 
     33 void TestAttemptState::PresetCryptohomeStatus(
     34     bool cryptohome_outcome,
     35     cryptohome::MountError cryptohome_code) {
     36   cryptohome_complete_ = true;
     37   cryptohome_outcome_ = cryptohome_outcome;
     38   cryptohome_code_ = cryptohome_code;
     39 }
     40 
     41 bool TestAttemptState::online_complete() {
     42   return online_complete_;
     43 }
     44 
     45 const AuthFailure& TestAttemptState::online_outcome() {
     46   return online_outcome_;
     47 }
     48 
     49 bool TestAttemptState::is_first_time_user() {
     50   return is_first_time_user_;
     51 }
     52 
     53 GaiaAuthFetcher::HostedAccountsSetting TestAttemptState::hosted_policy() {
     54   return hosted_policy_;
     55 }
     56 
     57 bool TestAttemptState::cryptohome_complete() {
     58   return cryptohome_complete_;
     59 }
     60 
     61 bool TestAttemptState::cryptohome_outcome() {
     62   return cryptohome_outcome_;
     63 }
     64 
     65 cryptohome::MountError TestAttemptState::cryptohome_code() {
     66   return cryptohome_code_;
     67 }
     68 
     69 }  // namespace chromeos
     70