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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/cryptauth/cryptauth_service.h ('k') | components/cryptauth/fake_cryptauth_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cryptauth/fake_cryptauth_service.h
diff --git a/components/cryptauth/fake_cryptauth_service.h b/components/cryptauth/fake_cryptauth_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..ba5ac1777f97fa73697abcc308ad100aeb4a2e33
--- /dev/null
+++ b/components/cryptauth/fake_cryptauth_service.h
@@ -0,0 +1,65 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_CRYPTAUTH_FAKE_CRYPTAUTH_SERVICE_H_
+#define COMPONENTS_CRYPTAUTH_FAKE_CRYPTAUTH_SERVICE_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "components/cryptauth/cryptauth_service.h"
+#include "components/cryptauth/proto/cryptauth_api.pb.h"
+
+namespace cryptauth {
+
+class CryptAuthClientFactory;
+class CryptAuthDeviceManager;
+class CryptAuthEnrollmentManager;
+class SecureMessageDelegate;
+
+// Service which provides access to various CryptAuth singletons.
+class FakeCryptAuthService : public CryptAuthService {
+ public:
+ FakeCryptAuthService();
+ ~FakeCryptAuthService() override;
+
+ void set_cryptauth_device_manager(
+ CryptAuthDeviceManager* cryptauth_device_manager) {
+ cryptauth_device_manager_ = cryptauth_device_manager;
+ }
+
+ void set_cryptauth_enrollment_manager(
+ CryptAuthEnrollmentManager* cryptauth_enrollment_manager) {
+ cryptauth_enrollment_manager_ = cryptauth_enrollment_manager;
+ }
+
+ void set_device_classifier(const DeviceClassifier& device_classifier) {
+ device_classifier_ = device_classifier;
+ }
+
+ void set_account_id(const std::string& account_id) {
+ account_id_ = account_id;
+ }
+
+ // CryptAuthService:
+ CryptAuthDeviceManager* GetCryptAuthDeviceManager() override;
+ CryptAuthEnrollmentManager* GetCryptAuthEnrollmentManager() override;
+ DeviceClassifier GetDeviceClassifier() override;
+ std::string GetAccountId() override;
+ std::unique_ptr<SecureMessageDelegate> CreateSecureMessageDelegate() override;
+ std::unique_ptr<CryptAuthClientFactory> CreateCryptAuthClientFactory()
+ override;
+
+ private:
+ CryptAuthDeviceManager* cryptauth_device_manager_;
+ CryptAuthEnrollmentManager* cryptauth_enrollment_manager_;
+ DeviceClassifier device_classifier_;
+ std::string account_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeCryptAuthService);
+};
+
+} // namespace cryptauth
+
+#endif // COMPONENTS_CRYPTAUTH_FAKE_CRYPTAUTH_SERVICE_H_
« 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