| 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 CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ | 5 #ifndef CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ |
| 6 #define CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ | 6 #define CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| 11 #include "chromeos/chromeos_export.h" | 11 #include "chromeos/chromeos_export.h" |
| 12 #include "chromeos/login/auth/authenticator.h" | 12 #include "chromeos/login/auth/authenticator.h" |
| 13 #include "chromeos/login/auth/user_context.h" | 13 #include "chromeos/login/auth/user_context.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 class Profile; | 16 namespace content { |
| 17 class BrowserContext; |
| 18 } |
| 17 | 19 |
| 18 namespace chromeos { | 20 namespace chromeos { |
| 19 | 21 |
| 20 class AuthStatusConsumer; | 22 class AuthStatusConsumer; |
| 21 | 23 |
| 22 class CHROMEOS_EXPORT MockAuthenticator : public Authenticator { | 24 class CHROMEOS_EXPORT MockAuthenticator : public Authenticator { |
| 23 public: | 25 public: |
| 24 MockAuthenticator(AuthStatusConsumer* consumer, | 26 MockAuthenticator(AuthStatusConsumer* consumer, |
| 25 const UserContext& expected_user_context); | 27 const UserContext& expected_user_context); |
| 26 | 28 |
| 27 // Authenticator: | 29 // Authenticator: |
| 28 virtual void CompleteLogin(Profile* profile, | 30 virtual void CompleteLogin(content::BrowserContext* context, |
| 29 const UserContext& user_context) override; | 31 const UserContext& user_context) override; |
| 30 virtual void AuthenticateToLogin(Profile* profile, | 32 virtual void AuthenticateToLogin(content::BrowserContext* context, |
| 31 const UserContext& user_context) override; | 33 const UserContext& user_context) override; |
| 32 virtual void AuthenticateToUnlock(const UserContext& user_context) override; | 34 virtual void AuthenticateToUnlock(const UserContext& user_context) override; |
| 33 virtual void LoginAsSupervisedUser(const UserContext& user_context) override; | 35 virtual void LoginAsSupervisedUser(const UserContext& user_context) override; |
| 34 virtual void LoginRetailMode() override; | 36 virtual void LoginRetailMode() override; |
| 35 virtual void LoginOffTheRecord() override; | 37 virtual void LoginOffTheRecord() override; |
| 36 virtual void LoginAsPublicSession(const UserContext& user_context) override; | 38 virtual void LoginAsPublicSession(const UserContext& user_context) override; |
| 37 virtual void LoginAsKioskAccount(const std::string& app_user_id, | 39 virtual void LoginAsKioskAccount(const std::string& app_user_id, |
| 38 bool use_guest_mount) override; | 40 bool use_guest_mount) override; |
| 39 virtual void OnRetailModeAuthSuccess() override; | 41 virtual void OnRetailModeAuthSuccess() override; |
| 40 virtual void OnAuthSuccess() override; | 42 virtual void OnAuthSuccess() override; |
| 41 virtual void OnAuthFailure(const AuthFailure& failure) override; | 43 virtual void OnAuthFailure(const AuthFailure& failure) override; |
| 42 virtual void RecoverEncryptedData(const std::string& old_password) override; | 44 virtual void RecoverEncryptedData(const std::string& old_password) override; |
| 43 virtual void ResyncEncryptedData() override; | 45 virtual void ResyncEncryptedData() override; |
| 44 | 46 |
| 45 virtual void SetExpectedCredentials(const UserContext& user_context); | 47 virtual void SetExpectedCredentials(const UserContext& user_context); |
| 46 | 48 |
| 47 protected: | 49 protected: |
| 48 virtual ~MockAuthenticator(); | 50 virtual ~MockAuthenticator(); |
| 49 | 51 |
| 50 private: | 52 private: |
| 51 UserContext expected_user_context_; | 53 UserContext expected_user_context_; |
| 52 scoped_refptr<base::MessageLoopProxy> message_loop_; | 54 scoped_refptr<base::MessageLoopProxy> message_loop_; |
| 53 | 55 |
| 54 DISALLOW_COPY_AND_ASSIGN(MockAuthenticator); | 56 DISALLOW_COPY_AND_ASSIGN(MockAuthenticator); |
| 55 }; | 57 }; |
| 56 | 58 |
| 57 } // namespace chromeos | 59 } // namespace chromeos |
| 58 | 60 |
| 59 #endif // CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ | 61 #endif // CHROMEOS_LOGIN_AUTH_MOCK_AUTHENTICATOR_H_ |
| OLD | NEW |