• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
TestAttemptState(const UserContext & credentials,const bool user_is_new)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 
~TestAttemptState()21 TestAttemptState::~TestAttemptState() {
22 }
23 
PresetOnlineLoginStatus(const AuthFailure & outcome)24 void TestAttemptState::PresetOnlineLoginStatus(const AuthFailure& outcome) {
25   online_complete_ = true;
26   online_outcome_ = outcome;
27 }
28 
DisableHosted()29 void TestAttemptState::DisableHosted() {
30   hosted_policy_ = GaiaAuthFetcher::HostedAccountsNotAllowed;
31 }
32 
PresetCryptohomeStatus(bool cryptohome_outcome,cryptohome::MountError cryptohome_code)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 
online_complete()41 bool TestAttemptState::online_complete() {
42   return online_complete_;
43 }
44 
online_outcome()45 const AuthFailure& TestAttemptState::online_outcome() {
46   return online_outcome_;
47 }
48 
is_first_time_user()49 bool TestAttemptState::is_first_time_user() {
50   return is_first_time_user_;
51 }
52 
hosted_policy()53 GaiaAuthFetcher::HostedAccountsSetting TestAttemptState::hosted_policy() {
54   return hosted_policy_;
55 }
56 
cryptohome_complete()57 bool TestAttemptState::cryptohome_complete() {
58   return cryptohome_complete_;
59 }
60 
cryptohome_outcome()61 bool TestAttemptState::cryptohome_outcome() {
62   return cryptohome_outcome_;
63 }
64 
cryptohome_code()65 cryptohome::MountError TestAttemptState::cryptohome_code() {
66   return cryptohome_code_;
67 }
68 
69 }  // namespace chromeos
70