Chromium Code Reviews| Index: chromeos/dbus/biod/test_utils.cc |
| diff --git a/chromeos/dbus/biod/test_utils.cc b/chromeos/dbus/biod/test_utils.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d41599f18e20e59d1873dd316671c6b160262dbc |
| --- /dev/null |
| +++ b/chromeos/dbus/biod/test_utils.cc |
| @@ -0,0 +1,82 @@ |
| +// 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. |
| + |
| +#include "chromeos/dbus/biod/test_utils.h" |
| + |
| +#include "base/logging.h" |
| +#include "dbus/object_path.h" |
| + |
| +namespace chromeos { |
| +namespace test_utils { |
| + |
| +void CopyObjectPath(dbus::ObjectPath* dest_path, |
| + const dbus::ObjectPath& src_path) { |
| + CHECK(dest_path); |
| + *dest_path = src_path; |
| +} |
| + |
| +void CopyObjectPathArray( |
| + std::vector<dbus::ObjectPath>* dest_object_paths, |
| + const std::vector<dbus::ObjectPath>& src_object_paths) { |
| + CHECK(dest_object_paths); |
| + *dest_object_paths = src_object_paths; |
| +} |
| + |
| +void CopyString(std::string* dest_str, const std::string& src_str) { |
| + CHECK(dest_str); |
| + *dest_str = src_str; |
| +} |
| + |
| +void CopyDBusMethodCallStatus(DBusMethodCallStatus* dest_status, |
| + DBusMethodCallStatus src_status) { |
| + CHECK(dest_status); |
| + *dest_status = src_status; |
| +} |
| + |
| +void CopyBiometricType(biod::BiometricType* dest_type, |
| + biod::BiometricType src_type) { |
| + CHECK(dest_type); |
| + *dest_type = src_type; |
| +} |
| + |
| +TestBiodObserver::TestBiodObserver() {} |
| + |
| +TestBiodObserver::~TestBiodObserver() {} |
| + |
| +bool TestBiodObserver::CheckExpectedLastAttemptMatches( |
| + const AuthScanMatches& expected_matches) { |
| + return expected_matches == last_auth_scan_matches_; |
|
Daniel Erat
2017/04/11 17:50:14
i don't understand why this method is needed. can
sammiequon
2017/04/11 18:37:50
Yeah, your way is makes much more sense. Done.
|
| +} |
| + |
| +int TestBiodObserver::NumEnrollScansReceived() const { |
| + return num_complete_enroll_scans_received_ + |
| + num_incomplete_enroll_scans_received_; |
| +} |
| + |
| +int TestBiodObserver::NumAuthScansReceived() const { |
| + return num_matched_auth_scans_received_ + num_unmatched_auth_scans_received_; |
| +} |
| + |
| +void TestBiodObserver::BiodServiceRestarted() {} |
| + |
| +void TestBiodObserver::BiodEnrollScanDoneReceived(biod::ScanResult scan_result, |
| + bool is_complete) { |
| + is_complete ? num_complete_enroll_scans_received_++ |
| + : num_incomplete_enroll_scans_received_++; |
| +} |
| + |
| +void TestBiodObserver::BiodAuthScanDoneReceived( |
| + biod::ScanResult scan_result, |
| + const AuthScanMatches& matches) { |
| + matches.empty() ? num_unmatched_auth_scans_received_++ |
| + : num_matched_auth_scans_received_++; |
| + last_auth_scan_matches_ = matches; |
| +} |
| + |
| +void TestBiodObserver::BiodSessionFailedReceived() { |
| + num_failures_received_++; |
| +} |
| + |
| +} // namepsace test_utils |
| +} // namespace chromeos |