Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Unified Diff: chromeos/dbus/biod/test_utils.h

Issue 2644233002: cros: Added a fake fingerprint storage class. (Closed)
Patch Set: Rebased. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromeos/dbus/biod/test_utils.h
diff --git a/chromeos/dbus/biod/test_utils.h b/chromeos/dbus/biod/test_utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..a71f93e79eda9f189f6f4d38714651894d81e688
--- /dev/null
+++ b/chromeos/dbus/biod/test_utils.h
@@ -0,0 +1,90 @@
+// 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.
+
+#ifndef CHROMEOS_DBUS_BIOD_TEST_UTILS_H_
+#define CHROMEOS_DBUS_BIOD_TEST_UTILS_H_
+
+#include <string>
+#include <vector>
+
+#include "base/macros.h"
+#include "chromeos/dbus/biod/biod_client.h"
+
+namespace dbus {
+class ObjectPath;
+}
+
+namespace chromeos {
+namespace test_utils {
+
+// Copies |src_path| to |dest_path|.
+void CopyObjectPath(dbus::ObjectPath* dest_path,
+ const dbus::ObjectPath& src_path);
+
+// Copies |src_object_paths| to |dst_object_paths|.
+void CopyObjectPathArray(std::vector<dbus::ObjectPath>* dest_object_paths,
+ const std::vector<dbus::ObjectPath>& src_object_paths);
+
+// Copies |src_str| to |dest_str|.
+void CopyString(std::string* dest_str, const std::string& src_str);
+
+// Copies |src_status| to |dest_status|.
+void CopyDBusMethodCallStatus(DBusMethodCallStatus* dest_status,
+ DBusMethodCallStatus src_status);
+
+// Copies |src_type| to |dest_type|.
+void CopyBiometricType(biod::BiometricType* dest_type,
+ biod::BiometricType src_type);
+
+// Implementation of BiodClient::Observer for testing.
+class TestBiodObserver : public BiodClient::Observer {
+ public:
+ TestBiodObserver();
+ ~TestBiodObserver() override;
+
+ int num_complete_enroll_scans_received() const {
+ return num_complete_enroll_scans_received_;
+ }
+ int num_incomplete_enroll_scans_received() const {
+ return num_incomplete_enroll_scans_received_;
+ }
+ int num_matched_auth_scans_received() const {
+ return num_matched_auth_scans_received_;
+ }
+ int num_unmatched_auth_scans_received() const {
+ return num_unmatched_auth_scans_received_;
+ }
+ int num_failures_received() const { return num_failures_received_; }
+
+ // Check's if the last attempt received in BiodAuthScanDoneReceived is equal
Daniel Erat 2017/04/11 17:50:14 nit: s/Check's/Check/
sammiequon 2017/04/11 18:37:50 Done.
+ // to |expected_matches|.
+ bool CheckExpectedLastAttemptMatches(const AuthScanMatches& expected_matches);
+ int NumEnrollScansReceived() const;
+ int NumAuthScansReceived() const;
+
+ // BiodClient::Observer:
+ void BiodServiceRestarted() override;
+ void BiodEnrollScanDoneReceived(biod::ScanResult scan_result,
+ bool is_complete) override;
+ void BiodAuthScanDoneReceived(biod::ScanResult scan_result,
+ const AuthScanMatches& matches) override;
+ void BiodSessionFailedReceived() override;
+
+ private:
+ int num_complete_enroll_scans_received_ = 0;
+ int num_incomplete_enroll_scans_received_ = 0;
+ int num_matched_auth_scans_received_ = 0;
+ int num_unmatched_auth_scans_received_ = 0;
+ int num_failures_received_ = 0;
+
+ // When auth scan is received, store the result.
+ AuthScanMatches last_auth_scan_matches_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestBiodObserver);
+};
+
+} // namespace test_utils
+} // chromeos
+
+#endif // CHROMEOS_DBUS_BIOD_TEST_UTILS_H_

Powered by Google App Engine
This is Rietveld 408576698