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/test_utils.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "dbus/object_path.h" |
| 9 |
| 10 namespace chromeos { |
| 11 namespace test_utils { |
| 12 |
| 13 void CopyObjectPath(dbus::ObjectPath* dest_path, |
| 14 const dbus::ObjectPath& src_path) { |
| 15 CHECK(dest_path); |
| 16 *dest_path = src_path; |
| 17 } |
| 18 |
| 19 void CopyObjectPathArray( |
| 20 std::vector<dbus::ObjectPath>* dest_object_paths, |
| 21 const std::vector<dbus::ObjectPath>& src_object_paths) { |
| 22 CHECK(dest_object_paths); |
| 23 *dest_object_paths = src_object_paths; |
| 24 } |
| 25 |
| 26 void CopyString(std::string* dest_str, const std::string& src_str) { |
| 27 CHECK(dest_str); |
| 28 *dest_str = src_str; |
| 29 } |
| 30 |
| 31 void CopyDBusMethodCallStatus(DBusMethodCallStatus* dest_status, |
| 32 DBusMethodCallStatus src_status) { |
| 33 CHECK(dest_status); |
| 34 *dest_status = src_status; |
| 35 } |
| 36 |
| 37 void CopyBiometricType(biod::BiometricType* dest_type, |
| 38 biod::BiometricType src_type) { |
| 39 CHECK(dest_type); |
| 40 *dest_type = src_type; |
| 41 } |
| 42 |
| 43 TestBiodObserver::TestBiodObserver() {} |
| 44 |
| 45 TestBiodObserver::~TestBiodObserver() {} |
| 46 |
| 47 int TestBiodObserver::NumEnrollScansReceived() const { |
| 48 return num_complete_enroll_scans_received_ + |
| 49 num_incomplete_enroll_scans_received_; |
| 50 } |
| 51 |
| 52 int TestBiodObserver::NumAuthScansReceived() const { |
| 53 return num_matched_auth_scans_received_ + num_unmatched_auth_scans_received_; |
| 54 } |
| 55 |
| 56 void TestBiodObserver::ResetAllCounts() { |
| 57 num_complete_enroll_scans_received_ = 0; |
| 58 num_incomplete_enroll_scans_received_ = 0; |
| 59 num_matched_auth_scans_received_ = 0; |
| 60 num_unmatched_auth_scans_received_ = 0; |
| 61 num_failures_received_ = 0; |
| 62 } |
| 63 |
| 64 void TestBiodObserver::BiodServiceRestarted() {} |
| 65 |
| 66 void TestBiodObserver::BiodEnrollScanDoneReceived(biod::ScanResult scan_result, |
| 67 bool is_complete) { |
| 68 is_complete ? num_complete_enroll_scans_received_++ |
| 69 : num_incomplete_enroll_scans_received_++; |
| 70 } |
| 71 |
| 72 void TestBiodObserver::BiodAuthScanDoneReceived( |
| 73 biod::ScanResult scan_result, |
| 74 const AuthScanMatches& matches) { |
| 75 matches.empty() ? num_unmatched_auth_scans_received_++ |
| 76 : num_matched_auth_scans_received_++; |
| 77 last_auth_scan_matches_ = matches; |
| 78 } |
| 79 |
| 80 void TestBiodObserver::BiodSessionFailedReceived() { |
| 81 num_failures_received_++; |
| 82 } |
| 83 |
| 84 } // namepsace test_utils |
| 85 } // namespace chromeos |
OLD | NEW |