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.
5 #ifndef CHROMEOS_LOGIN_AUTH_TEST_ATTEMPT_STATE_H_
6 #define CHROMEOS_LOGIN_AUTH_TEST_ATTEMPT_STATE_H_
8 #include "base/compiler_specific.h"
9 #include "chromeos/chromeos_export.h"
10 #include "chromeos/login/auth/auth_attempt_state.h"
11 #include "chromeos/login/auth/auth_status_consumer.h"
12 #include "google_apis/gaia/gaia_auth_consumer.h"
18 class CHROMEOS_EXPORT TestAttemptState
: public AuthAttemptState
{
20 TestAttemptState(const UserContext
& credentials
, const bool user_is_new
);
22 ~TestAttemptState() override
;
24 // Act as though an online login attempt completed already.
25 void PresetOnlineLoginStatus(const AuthFailure
& outcome
);
27 // Act as though an cryptohome login attempt completed already.
28 void PresetCryptohomeStatus(bool cryptohome_outcome
,
29 cryptohome::MountError cryptohome_code
);
31 // To allow state to be queried on the main thread during tests.
32 bool online_complete() override
;
33 const AuthFailure
& online_outcome() override
;
34 bool is_first_time_user() override
;
35 bool cryptohome_complete() override
;
36 bool cryptohome_outcome() override
;
37 cryptohome::MountError
cryptohome_code() override
;
40 DISALLOW_COPY_AND_ASSIGN(TestAttemptState
);
43 } // namespace chromeos
45 #endif // CHROMEOS_LOGIN_AUTH_TEST_ATTEMPT_STATE_H_