Chromium Code Reviews| Index: chromeos/dbus/biod/biod_test_utils.cc |
| diff --git a/chromeos/dbus/biod/biod_test_utils.cc b/chromeos/dbus/biod/biod_test_utils.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..59e63c00d5bef37841e2a604031982925aed402c |
| --- /dev/null |
| +++ b/chromeos/dbus/biod/biod_test_utils.cc |
| @@ -0,0 +1,73 @@ |
| +// 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/biod_test_utils.h" |
| + |
| +#include "dbus/object_path.h" |
|
Daniel Erat
2017/04/07 23:40:55
i think you should include base/logging.h for CHEC
sammiequon
2017/04/08 00:43:32
Done.
|
| + |
| +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 CopyNumRecords(int* out_num, |
| + const std::vector<dbus::ObjectPath>& object_path_array) { |
| + CHECK(out_num); |
| + *out_num = static_cast<int>(object_path_array.size()); |
| +} |
| + |
| +void CopyLabel(std::string* expected_label, const std::string& src_label) { |
| + CHECK(expected_label); |
| + *expected_label = src_label; |
| +} |
| + |
| +TestBiodObserver::TestBiodObserver() {} |
| + |
| +TestBiodObserver::~TestBiodObserver() {} |
| + |
| +bool TestBiodObserver::CheckExpectedLastAttemptMatches( |
| + const AuthScanMatches& expected_matches) { |
| + return expected_matches == last_auth_scan_matches_; |
| +} |
| + |
| +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::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 |