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.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_TEST_ATTEMPT_STATE_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_ATTEMPT_STATE_H_
10 #include "base/compiler_specific.h"
11 #include "chrome/browser/chromeos/login/auth_attempt_state.h"
12 #include "chrome/browser/chromeos/login/login_status_consumer.h"
13 #include "chrome/browser/chromeos/login/user.h"
14 #include "google_apis/gaia/gaia_auth_consumer.h"
18 class TestAttemptState
: public AuthAttemptState
{
20 TestAttemptState(const UserContext
& credentials
,
21 const std::string
& login_token
,
22 const std::string
& login_captcha
,
23 const User::UserType user_type
,
24 const bool user_is_new
);
26 virtual ~TestAttemptState();
28 // Act as though an online login attempt completed already.
29 void PresetOnlineLoginStatus(
30 const LoginFailure
& outcome
);
32 // The next attempt will not allow HOSTED accounts to log in.
35 // Act as though an cryptohome login attempt completed already.
36 void PresetCryptohomeStatus(bool cryptohome_outcome
,
37 cryptohome::MountError cryptohome_code
);
39 // To allow state to be queried on the main thread during tests.
40 virtual bool online_complete() OVERRIDE
;
41 virtual const LoginFailure
& online_outcome() OVERRIDE
;
42 virtual bool is_first_time_user() OVERRIDE
;
43 virtual GaiaAuthFetcher::HostedAccountsSetting
hosted_policy() OVERRIDE
;
44 virtual bool cryptohome_complete() OVERRIDE
;
45 virtual bool cryptohome_outcome() OVERRIDE
;
46 virtual cryptohome::MountError
cryptohome_code() OVERRIDE
;
49 DISALLOW_COPY_AND_ASSIGN(TestAttemptState
);
52 } // namespace chromeos
54 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_ATTEMPT_STATE_H_