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