Chromium Code Reviews| 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/biod_test_utils.h" | |
| 6 | |
| 7 #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.
| |
| 8 | |
| 9 namespace chromeos { | |
| 10 namespace test_utils { | |
| 11 | |
| 12 void CopyObjectPath(dbus::ObjectPath* dest_path, | |
| 13 const dbus::ObjectPath& src_path) { | |
| 14 CHECK(dest_path); | |
| 15 *dest_path = src_path; | |
| 16 } | |
| 17 | |
| 18 void CopyObjectPathArray( | |
| 19 std::vector<dbus::ObjectPath>* dest_object_paths, | |
| 20 const std::vector<dbus::ObjectPath>& src_object_paths) { | |
| 21 CHECK(dest_object_paths); | |
| 22 *dest_object_paths = src_object_paths; | |
| 23 } | |
| 24 | |
| 25 void CopyNumRecords(int* out_num, | |
| 26 const std::vector<dbus::ObjectPath>& object_path_array) { | |
| 27 CHECK(out_num); | |
| 28 *out_num = static_cast<int>(object_path_array.size()); | |
| 29 } | |
| 30 | |
| 31 void CopyLabel(std::string* expected_label, const std::string& src_label) { | |
| 32 CHECK(expected_label); | |
| 33 *expected_label = src_label; | |
| 34 } | |
| 35 | |
| 36 TestBiodObserver::TestBiodObserver() {} | |
| 37 | |
| 38 TestBiodObserver::~TestBiodObserver() {} | |
| 39 | |
| 40 bool TestBiodObserver::CheckExpectedLastAttemptMatches( | |
| 41 const AuthScanMatches& expected_matches) { | |
| 42 return expected_matches == last_auth_scan_matches_; | |
| 43 } | |
| 44 | |
| 45 int TestBiodObserver::NumEnrollScansReceived() const { | |
| 46 return num_complete_enroll_scans_received_ + | |
| 47 num_incomplete_enroll_scans_received_; | |
| 48 } | |
| 49 | |
| 50 int TestBiodObserver::NumAuthScansReceived() const { | |
| 51 return num_matched_auth_scans_received_ + num_unmatched_auth_scans_received_; | |
| 52 } | |
| 53 | |
| 54 void TestBiodObserver::BiodEnrollScanDoneReceived(biod::ScanResult scan_result, | |
| 55 bool is_complete) { | |
| 56 is_complete ? num_complete_enroll_scans_received_++ | |
| 57 : num_incomplete_enroll_scans_received_++; | |
| 58 } | |
| 59 | |
| 60 void TestBiodObserver::BiodAuthScanDoneReceived( | |
| 61 biod::ScanResult scan_result, | |
| 62 const AuthScanMatches& matches) { | |
| 63 matches.empty() ? num_unmatched_auth_scans_received_++ | |
| 64 : num_matched_auth_scans_received_++; | |
| 65 last_auth_scan_matches_ = matches; | |
| 66 } | |
| 67 | |
| 68 void TestBiodObserver::BiodSessionFailedReceived() { | |
| 69 num_failures_received_++; | |
| 70 } | |
| 71 | |
| 72 } // namepsace test_utils | |
| 73 } // namespace chromeos | |
| OLD | NEW |