Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: components/cryptauth/fake_cryptauth_service.h

Issue 2799683004: [CrOS Tether] Add FakeCryptAuthService, a test double for CryptAuthService. (Closed)
Patch Set: Added a missing #include. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_
OLDNEW
« no previous file with comments | « components/cryptauth/cryptauth_service.h ('k') | components/cryptauth/fake_cryptauth_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698