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

Unified Diff: chromeos/dbus/biod/fake_biod_client.h

Issue 2578323004: cros: Fake implementation of DBUS biometrics client. (Closed)
Patch Set: Oopsies. 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 | « chromeos/dbus/biod/biod_client.cc ('k') | chromeos/dbus/biod/fake_biod_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/biod/fake_biod_client.h
diff --git a/chromeos/dbus/biod/fake_biod_client.h b/chromeos/dbus/biod/fake_biod_client.h
new file mode 100644
index 0000000000000000000000000000000000000000..e4fd8410ce8f81f8ca952890d82e4a988af9cea6
--- /dev/null
+++ b/chromeos/dbus/biod/fake_biod_client.h
@@ -0,0 +1,63 @@
+// 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 CHROMEOS_DBUS_BIOD_FAKE_BIOD_CLIENT_H_
+#define CHROMEOS_DBUS_BIOD_FAKE_BIOD_CLIENT_H_
+
+#include "base/macros.h"
+#include "base/observer_list.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/biod/biod_client.h"
+
+namespace dbus {
+class Bus;
+class ObjectPath;
+} // namespace dbus
+
+namespace chromeos {
+
+// A fake implementation of BiodClient.
+class CHROMEOS_EXPORT FakeBiodClient : public BiodClient {
+ public:
+ FakeBiodClient();
+ ~FakeBiodClient() override;
+
+ // Emulates the biod daemon by sending events which the daemon normally sends.
+ // Notifies |observers_| about various events. These will be used in tests.
+ void SendEnrollScanDone(biod::ScanResult type_result, bool is_complete);
+ void SendAuthScanDone(biod::ScanResult type_result,
+ const AuthScanMatches& matches);
+ void SendSessionFailed();
+
+ // BiodClient:
+ void Init(dbus::Bus* bus) override;
+ void AddObserver(Observer* observer) override;
+ void RemoveObserver(Observer* observer) override;
+ bool HasObserver(const Observer* observer) const override;
+ void StartEnrollSession(const std::string& user_id,
+ const std::string& label,
+ const ObjectPathCallback& callback) override;
+ void GetRecordsForUser(const std::string& user_id,
+ const UserRecordsCallback& callback) override;
+ void DestroyAllRecords() override;
+ void StartAuthSession(const ObjectPathCallback& callback) override;
+ void RequestType(const BiometricTypeCallback& callback) override;
+ void CancelEnrollSession(
+ const dbus::ObjectPath& enroll_session_path) override;
+ void EndAuthSession(const dbus::ObjectPath& auth_session_path) override;
+ void SetRecordLabel(const dbus::ObjectPath& record_path,
+ const std::string& label) override;
+ void RemoveRecord(const dbus::ObjectPath& record_path) override;
+ void RequestRecordLabel(const dbus::ObjectPath& record_path,
+ const LabelCallback& callback) override;
+
+ private:
+ base::ObserverList<Observer> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeBiodClient);
+};
+
+} // namespace chromeos
+
+#endif // CHROMEOS_DBUS_BIOD_FAKE_BIOD_CLIENT_H_
« no previous file with comments | « chromeos/dbus/biod/biod_client.cc ('k') | chromeos/dbus/biod/fake_biod_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698