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

Unified Diff: chromeos/dbus/fake_biod_biometrics_manager_client.h

Issue 2578323004: cros: Fake implementation of DBUS biometrics client. (Closed)
Patch Set: Rebased to master. Created 3 years, 9 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
Index: chromeos/dbus/fake_biod_biometrics_manager_client.h
diff --git a/chromeos/dbus/fake_biod_biometrics_manager_client.h b/chromeos/dbus/fake_biod_biometrics_manager_client.h
new file mode 100644
index 0000000000000000000000000000000000000000..bb0e0ea1cc2db8754dc6b4d04cf95761ec85751e
--- /dev/null
+++ b/chromeos/dbus/fake_biod_biometrics_manager_client.h
@@ -0,0 +1,57 @@
+// 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_FAKE_BIOD_BIOMETRICS_MANAGER_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BIOD_BIOMETRICS_MANAGER_CLIENT_H_
+
+#include <stdint.h>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/observer_list.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/biod_biometrics_manager_client.h"
+#include "dbus/object_path.h"
+
+namespace chromeos {
+
+// A fake implementation of BiometricsClient.
+class CHROMEOS_EXPORT FakeBiodBiometricsManagerClient
+ : public BiodBiometricsManagerClient {
+ public:
+ FakeBiodBiometricsManagerClient();
+ ~FakeBiodBiometricsManagerClient() override;
+
+ // BiodBiometricsManagerClient overrides
+ 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 ObjectPathArrayCallback& callback) override;
+ void DestroyAllRecords() override;
+ void StartAuthSession(const ObjectPathCallback& callback) override;
+ void GetType(const BiometricTypeCallback& callback) override;
+ biod::BiometricType GetTypeBlocking() override;
+
+ private:
+ void OnEnrollScanDoneReceived(uint32_t type_result, bool is_complete);
+ void OnAuthScanDoneReceived(uint32_t type_result,
+ const AuthScanMatches& matches);
+ void OnScanFailedReceived();
+
+ base::ObserverList<Observer> observers_;
+ // Note: This should remain the last member so it'll be destroyed and
+ // invalidate its weak pointers before any other members are destroyed.
+ base::WeakPtrFactory<FakeBiodBiometricsManagerClient> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeBiodBiometricsManagerClient);
+};
+
+} // namespace chromeos
+
+#endif // CHROMEOS_DBUS_FAKE_BIOD_BIOMETRICS_MANAGER_CLIENT_H_

Powered by Google App Engine
This is Rietveld 408576698