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 #include "chromeos/dbus/biod/fake_biod_client.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "dbus/object_path.h" |
| 11 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 12 |
| 13 namespace chromeos { |
| 14 |
| 15 FakeBiodClient::FakeBiodClient() {} |
| 16 |
| 17 FakeBiodClient::~FakeBiodClient() {} |
| 18 |
| 19 void FakeBiodClient::SendEnrollScanDone(biod::ScanResult type_result, |
| 20 bool is_complete) { |
| 21 for (auto& observer : observers_) |
| 22 observer.BiodEnrollScanDoneReceived(type_result, is_complete); |
| 23 } |
| 24 |
| 25 void FakeBiodClient::SendAuthScanDone(biod::ScanResult type_result, |
| 26 const AuthScanMatches& matches) { |
| 27 for (auto& observer : observers_) |
| 28 observer.BiodAuthScanDoneReceived(type_result, matches); |
| 29 } |
| 30 |
| 31 void FakeBiodClient::SendSessionFailed() { |
| 32 for (auto& observer : observers_) |
| 33 observer.BiodSessionFailedReceived(); |
| 34 } |
| 35 |
| 36 void FakeBiodClient::Init(dbus::Bus* bus) {} |
| 37 |
| 38 void FakeBiodClient::AddObserver(Observer* observer) { |
| 39 observers_.AddObserver(observer); |
| 40 } |
| 41 |
| 42 void FakeBiodClient::RemoveObserver(Observer* observer) { |
| 43 observers_.RemoveObserver(observer); |
| 44 } |
| 45 |
| 46 bool FakeBiodClient::HasObserver(const Observer* observer) const { |
| 47 return observers_.HasObserver(observer); |
| 48 } |
| 49 |
| 50 void FakeBiodClient::StartEnrollSession(const std::string& /* user_id */, |
| 51 const std::string& /* label */, |
| 52 const ObjectPathCallback& callback) { |
| 53 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 54 FROM_HERE, base::Bind(callback, dbus::ObjectPath())); |
| 55 } |
| 56 |
| 57 void FakeBiodClient::GetRecordsForUser(const std::string& /* user_id */, |
| 58 const UserRecordsCallback& callback) { |
| 59 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 60 FROM_HERE, base::Bind(callback, std::vector<dbus::ObjectPath>())); |
| 61 } |
| 62 |
| 63 void FakeBiodClient::DestroyAllRecords() {} |
| 64 |
| 65 void FakeBiodClient::StartAuthSession(const ObjectPathCallback& callback) { |
| 66 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 67 FROM_HERE, base::Bind(callback, dbus::ObjectPath())); |
| 68 } |
| 69 |
| 70 void FakeBiodClient::RequestType(const BiometricTypeCallback& callback) { |
| 71 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 72 FROM_HERE, |
| 73 base::Bind(callback, biod::BiometricType::BIOMETRIC_TYPE_UNKNOWN)); |
| 74 } |
| 75 |
| 76 void FakeBiodClient::CancelEnrollSession( |
| 77 const dbus::ObjectPath& /* enroll_session_path */) {} |
| 78 |
| 79 void FakeBiodClient::EndAuthSession( |
| 80 const dbus::ObjectPath& /* auth_session_path */) {} |
| 81 |
| 82 void FakeBiodClient::SetRecordLabel(const dbus::ObjectPath& /* record_path */, |
| 83 const std::string& /* label */) {} |
| 84 |
| 85 void FakeBiodClient::RemoveRecord(const dbus::ObjectPath& /* record_path */) {} |
| 86 |
| 87 void FakeBiodClient::RequestRecordLabel( |
| 88 const dbus::ObjectPath& /* record_path */, |
| 89 const LabelCallback& callback) { |
| 90 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 91 base::Bind(callback, "")); |
| 92 } |
| 93 |
| 94 } // namespace chromeos |
OLD | NEW |