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 TestBiodObserver::TestBiodObserver() {} |
| 32 |
| 33 TestBiodObserver::~TestBiodObserver() {} |
| 34 |
| 35 bool TestBiodObserver::CheckExpectedLastAttemptMatches( |
| 36 const AuthScanMatches& expected_matches) { |
| 37 return expected_matches == last_auth_scan_matches_; |
| 38 } |
| 39 |
| 40 int TestBiodObserver::NumEnrollScansReceived() const { |
| 41 return num_complete_enroll_scans_received_ + |
| 42 num_incomplete_enroll_scans_received_; |
| 43 } |
| 44 |
| 45 int TestBiodObserver::NumAuthScansReceived() const { |
| 46 return num_matched_auth_scans_received_ + num_unmatched_auth_scans_received_; |
| 47 } |
| 48 |
| 49 void TestBiodObserver::BiodServiceRestarted() {} |
| 50 |
| 51 void TestBiodObserver::BiodEnrollScanDoneReceived(biod::ScanResult scan_result, |
| 52 bool is_complete) { |
| 53 is_complete ? num_complete_enroll_scans_received_++ |
| 54 : num_incomplete_enroll_scans_received_++; |
| 55 } |
| 56 |
| 57 void TestBiodObserver::BiodAuthScanDoneReceived( |
| 58 biod::ScanResult scan_result, |
| 59 const AuthScanMatches& matches) { |
| 60 matches.empty() ? num_unmatched_auth_scans_received_++ |
| 61 : num_matched_auth_scans_received_++; |
| 62 last_auth_scan_matches_ = matches; |
| 63 } |
| 64 |
| 65 void TestBiodObserver::BiodSessionFailedReceived() { |
| 66 num_failures_received_++; |
| 67 } |
| 68 |
| 69 } // namepsace test_utils |
| 70 } // namespace chromeos |
OLD | NEW |