| 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..46ebde1e99cfc5e85150c385dc208375637e5941
|
| --- /dev/null
|
| +++ b/chromeos/dbus/biod/test_utils.cc
|
| @@ -0,0 +1,85 @@
|
| +// 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() {}
|
| +
|
| +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::ResetAllCounts() {
|
| + num_complete_enroll_scans_received_ = 0;
|
| + num_incomplete_enroll_scans_received_ = 0;
|
| + num_matched_auth_scans_received_ = 0;
|
| + num_unmatched_auth_scans_received_ = 0;
|
| + num_failures_received_ = 0;
|
| +}
|
| +
|
| +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
|
|
|