OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 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. |
| 4 |
| 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_MOCK_SIGNING_SERVICE_H_ |
| 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_MOCK_SIGNING_SERVICE_H_ |
| 7 |
| 8 #include "components/policy/core/common/cloud/signing_service.h" |
| 9 |
| 10 #include "components/policy/proto/device_management_backend.pb.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" |
| 12 |
| 13 namespace policy { |
| 14 |
| 15 class FakeSigningService : public SigningService { |
| 16 public: |
| 17 FakeSigningService(); |
| 18 virtual ~FakeSigningService(); |
| 19 |
| 20 void SignRegistrationData( |
| 21 const enterprise_management::CertificateBasedDeviceRegistrationData* |
| 22 registration_data, |
| 23 enterprise_management::SignedData* signed_data); |
| 24 |
| 25 void SignData(const std::string& data, const SigningCallback& callback) |
| 26 override; |
| 27 |
| 28 void set_success(bool success); |
| 29 private: |
| 30 void DoSignData(const std::string& data, |
| 31 enterprise_management::SignedData* signed_data); |
| 32 |
| 33 bool success_ = true; |
| 34 }; |
| 35 |
| 36 class MockSigningService : public FakeSigningService { |
| 37 public: |
| 38 MockSigningService(); |
| 39 ~MockSigningService() override; |
| 40 |
| 41 MOCK_METHOD2(SignRegistrationData, |
| 42 void(const enterprise_management:: |
| 43 CertificateBasedDeviceRegistrationData*, |
| 44 enterprise_management::SignedData*)); |
| 45 MOCK_METHOD2(SignData, void(const std::string&, |
| 46 const SigningCallback&)); |
| 47 }; |
| 48 |
| 49 } |
| 50 |
| 51 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_MOCK_SIGNING_SERVICE_H_ |
OLD | NEW |