OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_PROXIMITY_AUTH_MOCK_PROXIMITY_AUTH_CLIENT_H_ | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_MOCK_PROXIMITY_AUTH_CLIENT_H_ |
6 #define COMPONENTS_PROXIMITY_AUTH_MOCK_PROXIMITY_AUTH_CLIENT_H_ | 6 #define COMPONENTS_PROXIMITY_AUTH_MOCK_PROXIMITY_AUTH_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "components/proximity_auth/cryptauth/cryptauth_client.h" | 12 #include "components/cryptauth/cryptauth_client.h" |
13 #include "components/proximity_auth/cryptauth/cryptauth_device_manager.h" | 13 #include "components/cryptauth/cryptauth_device_manager.h" |
14 #include "components/proximity_auth/cryptauth/cryptauth_enrollment_manager.h" | 14 #include "components/cryptauth/cryptauth_enrollment_manager.h" |
15 #include "components/proximity_auth/cryptauth/secure_message_delegate.h" | 15 #include "components/cryptauth/secure_message_delegate.h" |
16 #include "components/proximity_auth/proximity_auth_client.h" | 16 #include "components/proximity_auth/proximity_auth_client.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
18 | 18 |
19 namespace proximity_auth { | 19 namespace proximity_auth { |
20 | 20 |
21 // Mock implementation of ProximityAuthClient. | 21 // Mock implementation of ProximityAuthClient. |
22 class MockProximityAuthClient : public ProximityAuthClient { | 22 class MockProximityAuthClient : public ProximityAuthClient { |
23 public: | 23 public: |
24 MockProximityAuthClient(); | 24 MockProximityAuthClient(); |
25 ~MockProximityAuthClient() override; | 25 ~MockProximityAuthClient() override; |
26 | 26 |
27 // ProximityAuthClient: | 27 // ProximityAuthClient: |
28 MOCK_METHOD1(UpdateScreenlockState, | 28 MOCK_METHOD1(UpdateScreenlockState, |
29 void(proximity_auth::ScreenlockState state)); | 29 void(proximity_auth::ScreenlockState state)); |
30 MOCK_METHOD1(FinalizeUnlock, void(bool success)); | 30 MOCK_METHOD1(FinalizeUnlock, void(bool success)); |
31 MOCK_METHOD1(FinalizeSignin, void(const std::string& secret)); | 31 MOCK_METHOD1(FinalizeSignin, void(const std::string& secret)); |
32 MOCK_METHOD4( | 32 MOCK_METHOD4( |
33 GetChallengeForUserAndDevice, | 33 GetChallengeForUserAndDevice, |
34 void(const std::string& user_id, | 34 void(const std::string& user_id, |
35 const std::string& remote_public_key, | 35 const std::string& remote_public_key, |
36 const std::string& channel_binding_data, | 36 const std::string& channel_binding_data, |
37 base::Callback<void(const std::string& challenge)> callback)); | 37 base::Callback<void(const std::string& challenge)> callback)); |
38 MOCK_CONST_METHOD0(GetAuthenticatedUsername, std::string(void)); | 38 MOCK_CONST_METHOD0(GetAuthenticatedUsername, std::string(void)); |
39 MOCK_METHOD0(GetPrefService, PrefService*(void)); | 39 MOCK_METHOD0(GetPrefService, PrefService*(void)); |
40 MOCK_METHOD0(GetDeviceClassifier, cryptauth::DeviceClassifier(void)); | 40 MOCK_METHOD0(GetDeviceClassifier, cryptauth::DeviceClassifier(void)); |
41 MOCK_METHOD0(GetAccountId, std::string(void)); | 41 MOCK_METHOD0(GetAccountId, std::string(void)); |
42 MOCK_METHOD0(GetCryptAuthEnrollmentManager, | 42 MOCK_METHOD0(GetCryptAuthEnrollmentManager, |
43 CryptAuthEnrollmentManager*(void)); | 43 cryptauth::CryptAuthEnrollmentManager*(void)); |
44 MOCK_METHOD0(GetCryptAuthDeviceManager, CryptAuthDeviceManager*(void)); | 44 MOCK_METHOD0(GetCryptAuthDeviceManager, |
45 std::unique_ptr<SecureMessageDelegate> CreateSecureMessageDelegate() override; | 45 cryptauth::CryptAuthDeviceManager*(void)); |
46 std::unique_ptr<CryptAuthClientFactory> CreateCryptAuthClientFactory() | 46 std::unique_ptr<cryptauth::SecureMessageDelegate> |
47 override; | 47 CreateSecureMessageDelegate() override; |
| 48 std::unique_ptr<cryptauth::CryptAuthClientFactory> |
| 49 CreateCryptAuthClientFactory() override; |
48 | 50 |
49 // Proxy mock methods because implementation requires returning scoped_ptr. | 51 // Proxy mock methods because implementation requires returning scoped_ptr. |
50 MOCK_METHOD0(CreateSecureMessageDelegatePtr, SecureMessageDelegate*(void)); | 52 MOCK_METHOD0(CreateSecureMessageDelegatePtr, |
51 MOCK_METHOD0(CreateCryptAuthClientFactoryPtr, CryptAuthClientFactory*(void)); | 53 cryptauth::SecureMessageDelegate*(void)); |
| 54 MOCK_METHOD0(CreateCryptAuthClientFactoryPtr, |
| 55 cryptauth::CryptAuthClientFactory*(void)); |
52 | 56 |
53 private: | 57 private: |
54 DISALLOW_COPY_AND_ASSIGN(MockProximityAuthClient); | 58 DISALLOW_COPY_AND_ASSIGN(MockProximityAuthClient); |
55 }; | 59 }; |
56 | 60 |
57 } // namespace proximity_auth | 61 } // namespace proximity_auth |
58 | 62 |
59 #endif // COMPONENTS_PROXIMITY_AUTH_MOCK_PROXIMITY_AUTH_CLIENT_H_ | 63 #endif // COMPONENTS_PROXIMITY_AUTH_MOCK_PROXIMITY_AUTH_CLIENT_H_ |
OLD | NEW |