| 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 BrowserContextKeyedService; | 14 class BrowserContextKeyedService; |
| 15 | 15 |
| 16 // Overrides InitTokenService to do-nothing in tests. | 16 // Overrides InitTokenService to do-nothing in tests. |
| 17 class FakeSigninManagerBase : public SigninManagerBase { | 17 class FakeSigninManagerBase : public SigninManagerBase { |
| 18 public: | 18 public: |
| 19 explicit FakeSigninManagerBase(); | 19 explicit FakeSigninManagerBase(); |
| 20 virtual ~FakeSigninManagerBase(); | 20 virtual ~FakeSigninManagerBase(); |
| 21 | 21 |
| 22 virtual void InitTokenService() OVERRIDE; | |
| 23 | |
| 24 // Helper function to be used with | 22 // Helper function to be used with |
| 25 // BrowserContextKeyedService::SetTestingFactory(). | 23 // BrowserContextKeyedService::SetTestingFactory(). |
| 26 static BrowserContextKeyedService* Build(content::BrowserContext* profile); | 24 static BrowserContextKeyedService* Build(content::BrowserContext* profile); |
| 27 }; | 25 }; |
| 28 | 26 |
| 29 #if !defined(OS_CHROMEOS) | 27 #if !defined(OS_CHROMEOS) |
| 30 | 28 |
| 31 // A signin manager that bypasses actual authentication routines with servers | 29 // A signin manager that bypasses actual authentication routines with servers |
| 32 // and accepts the credentials provided to StartSignIn. | 30 // and accepts the credentials provided to StartSignIn. |
| 33 class FakeSigninManager : public SigninManager { | 31 class FakeSigninManager : public SigninManager { |
| 34 public: | 32 public: |
| 35 explicit FakeSigninManager(Profile* profile); | 33 explicit FakeSigninManager(Profile* profile); |
| 36 virtual ~FakeSigninManager(); | 34 virtual ~FakeSigninManager(); |
| 37 | 35 |
| 38 void set_auth_in_progress(const std::string& username) { | 36 void set_auth_in_progress(const std::string& username) { |
| 39 possibly_invalid_username_ = username; | 37 possibly_invalid_username_ = username; |
| 40 } | 38 } |
| 41 | 39 |
| 42 virtual void SignOut() OVERRIDE; | 40 virtual void SignOut() OVERRIDE; |
| 43 virtual void InitTokenService() OVERRIDE; | |
| 44 | 41 |
| 45 virtual void StartSignInWithCredentials( | 42 virtual void StartSignInWithCredentials( |
| 46 const std::string& session_index, | 43 const std::string& session_index, |
| 47 const std::string& username, | 44 const std::string& username, |
| 48 const std::string& password, | 45 const std::string& password, |
| 49 const OAuthTokenFetchedCallback& oauth_fetched_callback) OVERRIDE; | 46 const OAuthTokenFetchedCallback& oauth_fetched_callback) OVERRIDE; |
| 50 | 47 |
| 51 virtual void CompletePendingSignin() OVERRIDE; | 48 virtual void CompletePendingSignin() OVERRIDE; |
| 52 | 49 |
| 53 // Helper function to be used with | 50 // Helper function to be used with |
| 54 // BrowserContextKeyedService::SetTestingFactory(). | 51 // BrowserContextKeyedService::SetTestingFactory(). |
| 55 static BrowserContextKeyedService* Build(content::BrowserContext* profile); | 52 static BrowserContextKeyedService* Build(content::BrowserContext* profile); |
| 56 }; | 53 }; |
| 57 | 54 |
| 58 #endif // !defined (OS_CHROMEOS) | 55 #endif // !defined (OS_CHROMEOS) |
| 59 | 56 |
| 60 #endif // CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_H_ | 57 #endif // CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_H_ |
| OLD | NEW |