OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_H_ |
6 #define CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_H_ | 6 #define CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "chrome/browser/signin/signin_manager.h" | 11 #include "chrome/browser/signin/signin_manager.h" |
12 | 12 |
13 class Profile; | 13 class Profile; |
14 class ProfileKeyedService; | 14 class ProfileKeyedService; |
15 | 15 |
| 16 class FakeSigninManagerBase : public SigninManagerBase { |
| 17 public: |
| 18 explicit FakeSigninManagerBase(Profile* profile); |
| 19 virtual ~FakeSigninManagerBase(); |
| 20 |
| 21 virtual void SignOut() OVERRIDE; |
| 22 |
| 23 // Helper function to be used with ProfileKeyedService::SetTestingFactory(). |
| 24 static ProfileKeyedService* Build(Profile* profile); |
| 25 }; |
| 26 |
| 27 #if !defined(OS_CHROMEOS) |
| 28 |
16 // A signin manager that bypasses actual authentication routines with servers | 29 // A signin manager that bypasses actual authentication routines with servers |
17 // and accepts the credentials provided to StartSignIn. | 30 // and accepts the credentials provided to StartSignIn. |
18 class FakeSigninManager : public SigninManager { | 31 class FakeSigninManager : public SigninManager { |
19 public: | 32 public: |
20 explicit FakeSigninManager(Profile* profile); | 33 explicit FakeSigninManager(Profile* profile); |
21 virtual ~FakeSigninManager(); | 34 virtual ~FakeSigninManager(); |
22 | 35 |
| 36 void set_auth_in_progress(const std::string& username) { |
| 37 possibly_invalid_username_ = username; |
| 38 } |
| 39 |
| 40 virtual void SignOut() OVERRIDE; |
| 41 virtual void InitTokenService() OVERRIDE; |
23 virtual void StartSignIn(const std::string& username, | 42 virtual void StartSignIn(const std::string& username, |
24 const std::string& password, | 43 const std::string& password, |
25 const std::string& login_token, | 44 const std::string& login_token, |
26 const std::string& login_captcha) OVERRIDE; | 45 const std::string& login_captcha) OVERRIDE; |
| 46 |
27 virtual void StartSignInWithCredentials(const std::string& session_index, | 47 virtual void StartSignInWithCredentials(const std::string& session_index, |
28 const std::string& username, | 48 const std::string& username, |
29 const std::string& password) OVERRIDE; | 49 const std::string& password) OVERRIDE; |
30 virtual void StartSignInWithOAuth(const std::string& username, | 50 virtual void StartSignInWithOAuth(const std::string& username, |
31 const std::string& password) OVERRIDE; | 51 const std::string& password) OVERRIDE; |
32 virtual void SignOut() OVERRIDE; | |
33 | |
34 // Helper function to force a signout. | |
35 virtual void ForceSignOut(); | |
36 | |
37 void set_auth_in_progress(const std::string& username) { | |
38 possibly_invalid_username_ = username; | |
39 } | |
40 | 52 |
41 // Helper function to be used with ProfileKeyedService::SetTestingFactory(). | 53 // Helper function to be used with ProfileKeyedService::SetTestingFactory(). |
42 static ProfileKeyedService* Build(Profile* profile); | 54 static ProfileKeyedService* Build(Profile* profile); |
43 }; | 55 }; |
44 | 56 |
| 57 #endif // !defined (OS_CHROMEOS) |
| 58 |
45 #endif // CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_H_ | 59 #endif // CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_H_ |
OLD | NEW |