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_BIOD_TEST_UTILS_H_ | |
|
Daniel Erat
2017/04/07 23:40:55
consider renaming this file to test_utils to match
sammiequon
2017/04/11 17:11:37
Done.
| |
| 6 #define CHROMEOS_DBUS_BIOD_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 void CopyObjectPath(dbus::ObjectPath* dest_path, | |
|
Daniel Erat
2017/04/07 23:40:55
add brief comments to all of these like:
// Cop
sammiequon
2017/04/08 00:43:32
Done.
| |
| 22 const dbus::ObjectPath& src_path); | |
| 23 | |
| 24 void CopyObjectPathArray(std::vector<dbus::ObjectPath>* dest_object_paths, | |
| 25 const std::vector<dbus::ObjectPath>& src_object_paths); | |
| 26 | |
| 27 void CopyNumRecords(int* out_num, | |
| 28 const std::vector<dbus::ObjectPath>& object_path_array); | |
| 29 | |
| 30 void CopyLabel(std::string* expected_label, const std::string& src_label); | |
|
Daniel Erat
2017/04/07 23:40:55
CopyString? it's not label-specific.
sammiequon
2017/04/08 00:43:32
Done.
| |
| 31 | |
| 32 // Implementation of BiodClient::Observer for testing. | |
| 33 class TestBiodObserver : public BiodClient::Observer { | |
| 34 public: | |
| 35 TestBiodObserver(); | |
| 36 ~TestBiodObserver() override; | |
| 37 | |
| 38 bool CheckExpectedLastAttemptMatches(const AuthScanMatches& expected_matches); | |
|
Daniel Erat
2017/04/07 23:40:55
nit: document what this dose; also move non-inline
sammiequon
2017/04/08 00:43:32
Done.
| |
| 39 | |
| 40 int NumEnrollScansReceived() const; | |
| 41 | |
| 42 int num_complete_enroll_scans_received() const { | |
| 43 return num_complete_enroll_scans_received_; | |
| 44 } | |
| 45 | |
|
Daniel Erat
2017/04/07 23:40:55
nit: remove blank lines between accessors
sammiequon
2017/04/08 00:43:32
Done.
| |
| 46 int num_incomplete_enroll_scans_received() const { | |
| 47 return num_incomplete_enroll_scans_received_; | |
| 48 } | |
| 49 | |
| 50 int NumAuthScansReceived() const; | |
| 51 | |
| 52 int num_matched_auth_scans_received() const { | |
| 53 return num_matched_auth_scans_received_; | |
| 54 } | |
| 55 | |
| 56 int num_unmatched_auth_scans_received() const { | |
| 57 return num_unmatched_auth_scans_received_; | |
| 58 } | |
| 59 | |
| 60 int num_failures_received() const { return num_failures_received_; } | |
| 61 | |
| 62 // BiodClient::Observer: | |
| 63 void BiodServiceRestarted() override {} | |
|
Daniel Erat
2017/04/07 23:40:55
move this empty impl to the .cc file: https://www.
sammiequon
2017/04/08 00:43:32
Done.
| |
| 64 void BiodEnrollScanDoneReceived(biod::ScanResult scan_result, | |
| 65 bool is_complete) override; | |
| 66 void BiodAuthScanDoneReceived(biod::ScanResult scan_result, | |
| 67 const AuthScanMatches& matches) override; | |
| 68 | |
|
Daniel Erat
2017/04/07 23:40:55
nit: delete extra blank line
sammiequon
2017/04/08 00:43:32
Done.
| |
| 69 void BiodSessionFailedReceived() override; | |
| 70 | |
| 71 private: | |
| 72 int num_complete_enroll_scans_received_ = 0; | |
| 73 int num_incomplete_enroll_scans_received_ = 0; | |
| 74 int num_matched_auth_scans_received_ = 0; | |
| 75 int num_unmatched_auth_scans_received_ = 0; | |
| 76 int num_failures_received_ = 0; | |
| 77 | |
| 78 // When auth scan is received, store the result. | |
| 79 AuthScanMatches last_auth_scan_matches_; | |
| 80 | |
| 81 DISALLOW_COPY_AND_ASSIGN(TestBiodObserver); | |
| 82 }; | |
| 83 | |
| 84 } // namespace test_utils | |
| 85 } // chromeos | |
| 86 | |
| 87 #endif // CHROMEOS_DBUS_BIOD_BIOD_TEST_UTILS_H_ | |
| OLD | NEW |