| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_AUTH_MOCK_AUTHENTICATOR_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/chromeos/login/auth/authenticator.h" | 10 #include "chrome/browser/chromeos/login/auth/authenticator.h" |
| 11 #include "chrome/browser/chromeos/login/auth/user_context.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 class Profile; | 14 class Profile; |
| 14 | 15 |
| 15 namespace chromeos { | 16 namespace chromeos { |
| 16 | 17 |
| 17 class LoginStatusConsumer; | 18 class LoginStatusConsumer; |
| 18 | 19 |
| 19 class MockAuthenticator : public Authenticator { | 20 class MockAuthenticator : public Authenticator { |
| 20 public: | 21 public: |
| 21 MockAuthenticator(LoginStatusConsumer* consumer, | 22 MockAuthenticator(LoginStatusConsumer* consumer, |
| 22 const std::string& expected_username, | 23 const UserContext& expected_user_context); |
| 23 const std::string& expected_password) | |
| 24 : Authenticator(consumer), | |
| 25 expected_username_(expected_username), | |
| 26 expected_password_(expected_password) { | |
| 27 } | |
| 28 | 24 |
| 25 // Authenticator: |
| 29 virtual void CompleteLogin(Profile* profile, | 26 virtual void CompleteLogin(Profile* profile, |
| 30 const UserContext& user_context) OVERRIDE; | 27 const UserContext& user_context) OVERRIDE; |
| 31 | |
| 32 virtual void AuthenticateToLogin(Profile* profile, | 28 virtual void AuthenticateToLogin(Profile* profile, |
| 33 const UserContext& user_context) OVERRIDE; | 29 const UserContext& user_context) OVERRIDE; |
| 34 | |
| 35 virtual void AuthenticateToUnlock(const UserContext& user_context) OVERRIDE; | 30 virtual void AuthenticateToUnlock(const UserContext& user_context) OVERRIDE; |
| 36 | |
| 37 virtual void LoginAsLocallyManagedUser( | 31 virtual void LoginAsLocallyManagedUser( |
| 38 const UserContext& user_context) OVERRIDE; | 32 const UserContext& user_context) OVERRIDE; |
| 39 virtual void LoginRetailMode() OVERRIDE; | 33 virtual void LoginRetailMode() OVERRIDE; |
| 34 virtual void LoginOffTheRecord() OVERRIDE; |
| 40 virtual void LoginAsPublicAccount(const std::string& username) OVERRIDE; | 35 virtual void LoginAsPublicAccount(const std::string& username) OVERRIDE; |
| 41 virtual void LoginAsKioskAccount(const std::string& app_user_id, | 36 virtual void LoginAsKioskAccount(const std::string& app_user_id, |
| 42 bool use_guest_mount) OVERRIDE; | 37 bool use_guest_mount) OVERRIDE; |
| 43 virtual void LoginOffTheRecord() OVERRIDE; | 38 virtual void OnRetailModeLoginSuccess() OVERRIDE; |
| 39 virtual void OnLoginSuccess() OVERRIDE; |
| 40 virtual void OnLoginFailure(const LoginFailure& failure) OVERRIDE; |
| 41 virtual void RecoverEncryptedData( |
| 42 const std::string& old_password) OVERRIDE; |
| 43 virtual void ResyncEncryptedData() OVERRIDE; |
| 44 | 44 |
| 45 virtual void OnRetailModeLoginSuccess() OVERRIDE; | 45 virtual void SetExpectedCredentials(const UserContext& user_context); |
| 46 | |
| 47 virtual void OnLoginSuccess() OVERRIDE; | |
| 48 | |
| 49 virtual void OnLoginFailure(const LoginFailure& failure) OVERRIDE; | |
| 50 | |
| 51 virtual void RecoverEncryptedData( | |
| 52 const std::string& old_password) OVERRIDE {} | |
| 53 | |
| 54 virtual void ResyncEncryptedData() OVERRIDE {} | |
| 55 | |
| 56 virtual void SetExpectedCredentials(const std::string& expected_username, | |
| 57 const std::string& expected_password); | |
| 58 | 46 |
| 59 protected: | 47 protected: |
| 60 virtual ~MockAuthenticator() {} | 48 virtual ~MockAuthenticator(); |
| 61 | 49 |
| 62 private: | 50 private: |
| 63 std::string expected_username_; | 51 UserContext expected_user_context_; |
| 64 std::string expected_password_; | |
| 65 | 52 |
| 66 DISALLOW_COPY_AND_ASSIGN(MockAuthenticator); | 53 DISALLOW_COPY_AND_ASSIGN(MockAuthenticator); |
| 67 }; | 54 }; |
| 68 | 55 |
| 69 } // namespace chromeos | 56 } // namespace chromeos |
| 70 | 57 |
| 71 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ | 58 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ |
| OLD | NEW |