OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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_CRYPTAUTH_FAKE_CRYPTAUTH_SERVICE_H_ |
| 6 #define COMPONENTS_CRYPTAUTH_FAKE_CRYPTAUTH_SERVICE_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "components/cryptauth/cryptauth_service.h" |
| 12 #include "components/cryptauth/proto/cryptauth_api.pb.h" |
| 13 |
| 14 namespace cryptauth { |
| 15 |
| 16 class CryptAuthClientFactory; |
| 17 class CryptAuthDeviceManager; |
| 18 class CryptAuthEnrollmentManager; |
| 19 class SecureMessageDelegate; |
| 20 |
| 21 // Service which provides access to various CryptAuth singletons. |
| 22 class FakeCryptAuthService : public CryptAuthService { |
| 23 public: |
| 24 FakeCryptAuthService(); |
| 25 ~FakeCryptAuthService() override; |
| 26 |
| 27 void set_cryptauth_device_manager( |
| 28 CryptAuthDeviceManager* cryptauth_device_manager) { |
| 29 cryptauth_device_manager_ = cryptauth_device_manager; |
| 30 } |
| 31 |
| 32 void set_cryptauth_enrollment_manager( |
| 33 CryptAuthEnrollmentManager* cryptauth_enrollment_manager) { |
| 34 cryptauth_enrollment_manager_ = cryptauth_enrollment_manager; |
| 35 } |
| 36 |
| 37 void set_device_classifier(const DeviceClassifier& device_classifier) { |
| 38 device_classifier_ = device_classifier; |
| 39 } |
| 40 |
| 41 void set_account_id(const std::string& account_id) { |
| 42 account_id_ = account_id; |
| 43 } |
| 44 |
| 45 // CryptAuthService: |
| 46 CryptAuthDeviceManager* GetCryptAuthDeviceManager() override; |
| 47 CryptAuthEnrollmentManager* GetCryptAuthEnrollmentManager() override; |
| 48 DeviceClassifier GetDeviceClassifier() override; |
| 49 std::string GetAccountId() override; |
| 50 std::unique_ptr<SecureMessageDelegate> CreateSecureMessageDelegate() override; |
| 51 std::unique_ptr<CryptAuthClientFactory> CreateCryptAuthClientFactory() |
| 52 override; |
| 53 |
| 54 private: |
| 55 CryptAuthDeviceManager* cryptauth_device_manager_; |
| 56 CryptAuthEnrollmentManager* cryptauth_enrollment_manager_; |
| 57 DeviceClassifier device_classifier_; |
| 58 std::string account_id_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(FakeCryptAuthService); |
| 61 }; |
| 62 |
| 63 } // namespace cryptauth |
| 64 |
| 65 #endif // COMPONENTS_CRYPTAUTH_FAKE_CRYPTAUTH_SERVICE_H_ |
OLD | NEW |