Disable accessible touch exploration by default.
[chromium-blink-merge.git] / chrome / browser / signin / fake_signin_manager.h
blobf491ac9c2240665f4a0c8de52b3abf4e31d8069a
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_SIGNIN_FAKE_SIGNIN_MANAGER_H_
6 #define CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "components/signin/core/browser/signin_manager.h"
12 #include "components/signin/core/browser/signin_metrics.h"
14 namespace content {
15 class BrowserContext;
18 class Profile;
20 // SigninManager to use for testing. Tests should use the type
21 // SigninManagerForTesting to ensure that the right type for their platform is
22 // used.
24 // Overrides InitTokenService to do-nothing in tests.
25 class FakeSigninManagerBase : public SigninManagerBase {
26 public:
27 explicit FakeSigninManagerBase(Profile* profile);
28 virtual ~FakeSigninManagerBase();
30 // Helper function to be used with
31 // KeyedService::SetTestingFactory(). In order to match
32 // the API of SigninManagerFactory::GetForProfile(), returns a
33 // FakeSigninManagerBase* on ChromeOS, and a FakeSigninManager* on all other
34 // platforms. The returned instance is initialized.
35 static KeyedService* Build(content::BrowserContext* context);
38 #if !defined(OS_CHROMEOS)
40 // A signin manager that bypasses actual authentication routines with servers
41 // and accepts the credentials provided to StartSignIn.
42 class FakeSigninManager : public SigninManager {
43 public:
44 explicit FakeSigninManager(Profile* profile);
45 virtual ~FakeSigninManager();
47 void set_auth_in_progress(const std::string& username) {
48 possibly_invalid_username_ = username;
51 void set_password(const std::string& password) { password_ = password; }
53 void SignIn(const std::string& username, const std::string& password);
55 void FailSignin(const GoogleServiceAuthError& error);
57 virtual void StartSignInWithRefreshToken(
58 const std::string& refresh_token,
59 const std::string& username,
60 const std::string& password,
61 const OAuthTokenFetchedCallback& oauth_fetched_callback) OVERRIDE;
63 virtual void SignOut(signin_metrics::ProfileSignout signout_source_metric)
64 OVERRIDE;
66 virtual void CompletePendingSignin() OVERRIDE;
68 virtual void AddMergeSessionObserver(
69 MergeSessionHelper::Observer* observer) OVERRIDE;
70 virtual void RemoveMergeSessionObserver(
71 MergeSessionHelper::Observer* observer) OVERRIDE;
73 void NotifyMergeSessionObservers(const GoogleServiceAuthError& error);
75 private:
76 ObserverList<MergeSessionHelper::Observer, true> merge_session_observer_list_;
79 #endif // !defined (OS_CHROMEOS)
81 #if defined(OS_CHROMEOS)
82 typedef FakeSigninManagerBase FakeSigninManagerForTesting;
83 #else
84 typedef FakeSigninManager FakeSigninManagerForTesting;
85 #endif
87 #endif // CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_H_