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

Unified Diff: components/password_manager/core/browser/stub_credentials_filter.h

Issue 2260203004: Create StubCredentialsFilter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@621355_best_matches_const
Patch Set: Rebased to avoid dependency Created 4 years, 4 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: components/password_manager/core/browser/stub_credentials_filter.h
diff --git a/components/password_manager/core/browser/stub_credentials_filter.h b/components/password_manager/core/browser/stub_credentials_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..03fcd34c671609bff01e838dd16789fe6baffd20
--- /dev/null
+++ b/components/password_manager/core/browser/stub_credentials_filter.h
@@ -0,0 +1,41 @@
+// Copyright 2016 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 COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STUB_CREDENTIALS_FILTER_H_
+#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STUB_CREDENTIALS_FILTER_H_
+
+#include "base/macros.h"
+#include "components/password_manager/core/browser/credentials_filter.h"
+
+namespace password_manager {
+
+// Stub of the CredentialsFilter API, to be used in tests. This filter does
+// not filter out anything.
+class StubCredentialsFilter : public CredentialsFilter {
+ public:
+ StubCredentialsFilter();
+
+ ~StubCredentialsFilter() override;
+
+ // CredentialsFilter
+ std::vector<std::unique_ptr<autofill::PasswordForm>> FilterResults(
+ std::vector<std::unique_ptr<autofill::PasswordForm>> results)
+ const override;
+ bool ShouldSave(const autofill::PasswordForm& form) const override;
+ void ReportFormLoginSuccess(
+ const PasswordFormManager& form_manager) const override;
+
+ // A version of FilterResult without moveable arguments, which cannot be
+ // mocked in GMock. StubCredentialsFilter::FilterResults(arg) calls
+ // FilterResultsPtr(&arg).
+ virtual void FilterResultsPtr(
+ std::vector<std::unique_ptr<autofill::PasswordForm>>* results) const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(StubCredentialsFilter);
+};
+
+} // namespace password_manager
+
+#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STUB_CREDENTIALS_FILTER_H_

Powered by Google App Engine
This is Rietveld 408576698