| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CHROMEOS_LOGIN_FAKE_LOGIN_UTILS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_LOGIN_UTILS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_LOGIN_UTILS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_LOGIN_UTILS_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/chromeos/login/auth/user_context.h" | 8 #include "chrome/browser/chromeos/login/auth/user_context.h" |
| 9 #include "chrome/browser/chromeos/login/login_utils.h" | 9 #include "chrome/browser/chromeos/login/login_utils.h" |
| 10 | 10 |
| 11 namespace chromeos { | 11 namespace chromeos { |
| 12 | 12 |
| 13 // This class emulates behavior of LoginUtils for browser tests. | 13 // This class emulates behavior of LoginUtils for browser tests. |
| 14 // It provides: | 14 // It provides: |
| 15 // * Fake authentication. You can configure expected usernames and password for | 15 // * Fake authentication. You can configure expected usernames and password for |
| 16 // next auth attempt. | 16 // next auth attempt. |
| 17 // * Preparing of profiles for authenticated users. | 17 // * Preparing of profiles for authenticated users. |
| 18 // * Launching browser for user, if |should_launch_browser_| set. | 18 // * Launching browser for user, if |should_launch_browser_| set. |
| 19 // * Correct communication with LoginDisplayHost and UserManager. | 19 // * Correct communication with LoginDisplayHost and UserManager. |
| 20 class FakeLoginUtils : public LoginUtils { | 20 class FakeLoginUtils : public LoginUtils { |
| 21 public: | 21 public: |
| 22 FakeLoginUtils(); | 22 FakeLoginUtils(); |
| 23 virtual ~FakeLoginUtils(); | 23 virtual ~FakeLoginUtils(); |
| 24 virtual void DoBrowserLaunch(Profile* profile, | 24 virtual void DoBrowserLaunch(Profile* profile, |
| 25 LoginDisplayHost* login_host) OVERRIDE; | 25 LoginDisplayHost* login_host) OVERRIDE; |
| 26 virtual void PrepareProfile(const UserContext& user_context, | 26 virtual void PrepareProfile(const UserContext& user_context, |
| 27 const std::string& display_email, |
| 27 bool has_cookies, | 28 bool has_cookies, |
| 28 bool has_active_session, | 29 bool has_active_session, |
| 29 LoginUtils::Delegate* delegate) OVERRIDE; | 30 LoginUtils::Delegate* delegate) OVERRIDE; |
| 30 virtual void DelegateDeleted(LoginUtils::Delegate* delegate) OVERRIDE; | 31 virtual void DelegateDeleted(LoginUtils::Delegate* delegate) OVERRIDE; |
| 31 virtual void CompleteOffTheRecordLogin(const GURL& start_url) OVERRIDE; | 32 virtual void CompleteOffTheRecordLogin(const GURL& start_url) OVERRIDE; |
| 33 virtual void SetFirstLoginPrefs(PrefService* prefs) OVERRIDE; |
| 32 virtual scoped_refptr<Authenticator> CreateAuthenticator( | 34 virtual scoped_refptr<Authenticator> CreateAuthenticator( |
| 33 LoginStatusConsumer* consumer) OVERRIDE; | 35 LoginStatusConsumer* consumer) OVERRIDE; |
| 36 virtual void RestoreAuthenticationSession(Profile* profile) OVERRIDE; |
| 37 virtual void InitRlzDelayed(Profile* user_profile) OVERRIDE; |
| 34 | 38 |
| 35 void SetExpectedCredentials(const UserContext& user_context); | 39 void SetExpectedCredentials(const UserContext& user_context); |
| 36 void set_should_launch_browser(bool should_launch_browser) { | 40 void set_should_launch_browser(bool should_launch_browser) { |
| 37 should_launch_browser_ = should_launch_browser; | 41 should_launch_browser_ = should_launch_browser; |
| 38 } | 42 } |
| 39 | 43 |
| 40 private: | 44 private: |
| 41 scoped_refptr<Authenticator> authenticator_; | 45 scoped_refptr<Authenticator> authenticator_; |
| 42 UserContext expected_user_context_; | 46 UserContext expected_user_context_; |
| 43 bool should_launch_browser_; | 47 bool should_launch_browser_; |
| 44 | 48 |
| 45 DISALLOW_COPY_AND_ASSIGN(FakeLoginUtils); | 49 DISALLOW_COPY_AND_ASSIGN(FakeLoginUtils); |
| 46 }; | 50 }; |
| 47 | 51 |
| 48 } // namespace chromeos | 52 } // namespace chromeos |
| 49 | 53 |
| 50 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_LOGIN_UTILS_H_ | 54 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_LOGIN_UTILS_H_ |
| OLD | NEW |