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 CHROMEOS_DBUS_BIOD_FAKE_BIOD_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_BIOD_FAKE_BIOD_CLIENT_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/observer_list.h" |
| 10 #include "chromeos/chromeos_export.h" |
| 11 #include "chromeos/dbus/biod/biod_client.h" |
| 12 |
| 13 namespace dbus { |
| 14 class Bus; |
| 15 class ObjectPath; |
| 16 } // namespace dbus |
| 17 |
| 18 namespace chromeos { |
| 19 |
| 20 // A fake implementation of BiodClient. |
| 21 class CHROMEOS_EXPORT FakeBiodClient : public BiodClient { |
| 22 public: |
| 23 FakeBiodClient(); |
| 24 ~FakeBiodClient() override; |
| 25 |
| 26 // Emulates the biod daemon by sending events which the daemon normally sends. |
| 27 // Notifies |observers_| about various events. These will be used in tests. |
| 28 void SendEnrollScanDone(biod::ScanResult type_result, bool is_complete); |
| 29 void SendAuthScanDone(biod::ScanResult type_result, |
| 30 const AuthScanMatches& matches); |
| 31 void SendSessionFailed(); |
| 32 |
| 33 // BiodClient: |
| 34 void Init(dbus::Bus* bus) override; |
| 35 void AddObserver(Observer* observer) override; |
| 36 void RemoveObserver(Observer* observer) override; |
| 37 bool HasObserver(const Observer* observer) const override; |
| 38 void StartEnrollSession(const std::string& user_id, |
| 39 const std::string& label, |
| 40 const ObjectPathCallback& callback) override; |
| 41 void GetRecordsForUser(const std::string& user_id, |
| 42 const UserRecordsCallback& callback) override; |
| 43 void DestroyAllRecords() override; |
| 44 void StartAuthSession(const ObjectPathCallback& callback) override; |
| 45 void RequestType(const BiometricTypeCallback& callback) override; |
| 46 void CancelEnrollSession( |
| 47 const dbus::ObjectPath& enroll_session_path) override; |
| 48 void EndAuthSession(const dbus::ObjectPath& auth_session_path) override; |
| 49 void SetRecordLabel(const dbus::ObjectPath& record_path, |
| 50 const std::string& label) override; |
| 51 void RemoveRecord(const dbus::ObjectPath& record_path) override; |
| 52 void RequestRecordLabel(const dbus::ObjectPath& record_path, |
| 53 const LabelCallback& callback) override; |
| 54 |
| 55 private: |
| 56 base::ObserverList<Observer> observers_; |
| 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(FakeBiodClient); |
| 59 }; |
| 60 |
| 61 } // namespace chromeos |
| 62 |
| 63 #endif // CHROMEOS_DBUS_BIOD_FAKE_BIOD_CLIENT_H_ |
OLD | NEW |