OLD | NEW |
| (Empty) |
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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_TEST_ATTEMPT_STATE_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_ATTEMPT_STATE_H_ | |
7 | |
8 #include <string> | |
9 | |
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" | |
15 | |
16 namespace chromeos { | |
17 | |
18 class TestAttemptState : public AuthAttemptState { | |
19 public: | |
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); | |
25 | |
26 virtual ~TestAttemptState(); | |
27 | |
28 // Act as though an online login attempt completed already. | |
29 void PresetOnlineLoginStatus( | |
30 const LoginFailure& outcome); | |
31 | |
32 // The next attempt will not allow HOSTED accounts to log in. | |
33 void DisableHosted(); | |
34 | |
35 // Act as though an cryptohome login attempt completed already. | |
36 void PresetCryptohomeStatus(bool cryptohome_outcome, | |
37 cryptohome::MountError cryptohome_code); | |
38 | |
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; | |
47 | |
48 private: | |
49 DISALLOW_COPY_AND_ASSIGN(TestAttemptState); | |
50 }; | |
51 | |
52 } // namespace chromeos | |
53 | |
54 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_ATTEMPT_STATE_H_ | |
OLD | NEW |