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 bool TestBiodObserver::CheckExpectedLastAttemptMatches( | |
48 const AuthScanMatches& expected_matches) { | |
49 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.
| |
50 } | |
51 | |
52 int TestBiodObserver::NumEnrollScansReceived() const { | |
53 return num_complete_enroll_scans_received_ + | |
54 num_incomplete_enroll_scans_received_; | |
55 } | |
56 | |
57 int TestBiodObserver::NumAuthScansReceived() const { | |
58 return num_matched_auth_scans_received_ + num_unmatched_auth_scans_received_; | |
59 } | |
60 | |
61 void TestBiodObserver::BiodServiceRestarted() {} | |
62 | |
63 void TestBiodObserver::BiodEnrollScanDoneReceived(biod::ScanResult scan_result, | |
64 bool is_complete) { | |
65 is_complete ? num_complete_enroll_scans_received_++ | |
66 : num_incomplete_enroll_scans_received_++; | |
67 } | |
68 | |
69 void TestBiodObserver::BiodAuthScanDoneReceived( | |
70 biod::ScanResult scan_result, | |
71 const AuthScanMatches& matches) { | |
72 matches.empty() ? num_unmatched_auth_scans_received_++ | |
73 : num_matched_auth_scans_received_++; | |
74 last_auth_scan_matches_ = matches; | |
75 } | |
76 | |
77 void TestBiodObserver::BiodSessionFailedReceived() { | |
78 num_failures_received_++; | |
79 } | |
80 | |
81 } // namepsace test_utils | |
82 } // namespace chromeos | |
OLD | NEW |