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 #ifndef CHROMEOS_DBUS_BIOD_TEST_UTILS_H_ | |
| 6 #define CHROMEOS_DBUS_BIOD_TEST_UTILS_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "chromeos/dbus/biod/biod_client.h" | |
| 13 | |
| 14 namespace dbus { | |
| 15 class ObjectPath; | |
| 16 } | |
| 17 | |
| 18 namespace chromeos { | |
| 19 namespace test_utils { | |
| 20 | |
| 21 // Copies |src_path| to |dest_path|. | |
| 22 void CopyObjectPath(dbus::ObjectPath* dest_path, | |
| 23 const dbus::ObjectPath& src_path); | |
| 24 | |
| 25 // Copies |src_object_paths| to |dst_object_paths|. | |
| 26 void CopyObjectPathArray(std::vector<dbus::ObjectPath>* dest_object_paths, | |
| 27 const std::vector<dbus::ObjectPath>& src_object_paths); | |
| 28 | |
| 29 void CopyString(std::string* dest_str, const std::string& src_str); | |
|
sammiequon
2017/04/08 00:43:33
Oops will do comment this next cycle.
| |
| 30 | |
| 31 // Implementation of BiodClient::Observer for testing. | |
| 32 class TestBiodObserver : public BiodClient::Observer { | |
| 33 public: | |
| 34 TestBiodObserver(); | |
| 35 ~TestBiodObserver() override; | |
| 36 | |
| 37 int num_complete_enroll_scans_received() const { | |
| 38 return num_complete_enroll_scans_received_; | |
| 39 } | |
| 40 int num_incomplete_enroll_scans_received() const { | |
| 41 return num_incomplete_enroll_scans_received_; | |
| 42 } | |
| 43 int num_matched_auth_scans_received() const { | |
| 44 return num_matched_auth_scans_received_; | |
| 45 } | |
| 46 int num_unmatched_auth_scans_received() const { | |
| 47 return num_unmatched_auth_scans_received_; | |
| 48 } | |
| 49 int num_failures_received() const { return num_failures_received_; } | |
| 50 | |
| 51 // Check's if the last attempt received in BiodAuthScanDoneReceived is equal | |
| 52 // to |expected_matches|. | |
| 53 bool CheckExpectedLastAttemptMatches(const AuthScanMatches& expected_matches); | |
| 54 int NumEnrollScansReceived() const; | |
| 55 int NumAuthScansReceived() const; | |
| 56 | |
| 57 // BiodClient::Observer: | |
| 58 void BiodServiceRestarted() override; | |
| 59 void BiodEnrollScanDoneReceived(biod::ScanResult scan_result, | |
| 60 bool is_complete) override; | |
| 61 void BiodAuthScanDoneReceived(biod::ScanResult scan_result, | |
| 62 const AuthScanMatches& matches) override; | |
| 63 void BiodSessionFailedReceived() override; | |
| 64 | |
| 65 private: | |
| 66 int num_complete_enroll_scans_received_ = 0; | |
| 67 int num_incomplete_enroll_scans_received_ = 0; | |
| 68 int num_matched_auth_scans_received_ = 0; | |
| 69 int num_unmatched_auth_scans_received_ = 0; | |
| 70 int num_failures_received_ = 0; | |
| 71 | |
| 72 // When auth scan is received, store the result. | |
| 73 AuthScanMatches last_auth_scan_matches_; | |
| 74 | |
| 75 DISALLOW_COPY_AND_ASSIGN(TestBiodObserver); | |
| 76 }; | |
| 77 | |
| 78 } // namespace test_utils | |
| 79 } // chromeos | |
| 80 | |
| 81 #endif // CHROMEOS_DBUS_BIOD_TEST_UTILS_H_ | |
| OLD | NEW |