Index: components/password_manager/core/browser/mock_affiliated_match_helper.h |
diff --git a/components/password_manager/core/browser/mock_affiliated_match_helper.h b/components/password_manager/core/browser/mock_affiliated_match_helper.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cd843ce9dd4e2a89bef24498c9b28b2ff5e5acf3 |
--- /dev/null |
+++ b/components/password_manager/core/browser/mock_affiliated_match_helper.h |
@@ -0,0 +1,64 @@ |
+// Copyright 2015 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_MOCK_AFFILIATED_MATCH_HELPER_H_ |
+#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_MOCK_AFFILIATED_MATCH_HELPER_H_ |
+ |
+#include "base/macros.h" |
+#include "components/password_manager/core/browser/affiliated_match_helper.h" |
+#include "testing/gmock/include/gmock/gmock.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+namespace autofill { |
+struct PasswordForm; |
+} |
+ |
+namespace password_manager { |
+ |
+class MockAffiliatedMatchHelper : public AffiliatedMatchHelper { |
+ public: |
+ MockAffiliatedMatchHelper(); |
+ ~MockAffiliatedMatchHelper() override; |
+ |
+ // Expects GetAffiliatedAndroidRealms() to be called with the |
+ // |expected_observed_form|, and will cause the result callback supplied to |
+ // GetAffiliatedAndroidRealms() to be invoked with |results_to_return|. |
+ void ExpectCallToGetAffiliatedAndroidRealms( |
+ const PasswordStore::FormDigest& expected_observed_form, |
+ const std::vector<std::string>& results_to_return); |
+ |
+ // Expects GetAffiliatedWebRealms() to be called with the |
+ // |expected_android_form|, and will cause the result callback supplied to |
+ // GetAffiliatedWebRealms() to be invoked with |results_to_return|. |
+ void ExpectCallToGetAffiliatedWebRealms( |
+ const PasswordStore::FormDigest& expected_android_form, |
+ const std::vector<std::string>& results_to_return); |
+ |
+ void ExpectCallToInjectAffiliatedWebRealms( |
+ const std::vector<std::string>& results_to_inject); |
+ |
+ private: |
+ MOCK_METHOD1(OnGetAffiliatedAndroidRealmsCalled, |
+ std::vector<std::string>(const PasswordStore::FormDigest&)); |
+ MOCK_METHOD1(OnGetAffiliatedWebRealmsCalled, |
+ std::vector<std::string>(const PasswordStore::FormDigest&)); |
+ MOCK_METHOD0(OnInjectAffiliatedWebRealmsCalled, std::vector<std::string>()); |
+ |
+ void GetAffiliatedAndroidRealms( |
+ const PasswordStore::FormDigest& observed_form, |
+ const AffiliatedRealmsCallback& result_callback) override; |
+ void GetAffiliatedWebRealms( |
+ const PasswordStore::FormDigest& android_form, |
+ const AffiliatedRealmsCallback& result_callback) override; |
+ |
+ void InjectAffiliatedWebRealms( |
+ std::vector<std::unique_ptr<autofill::PasswordForm>> forms, |
+ const PasswordFormsCallback& result_callback) override; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(MockAffiliatedMatchHelper); |
+}; |
+ |
+} // namespace password_manager |
+ |
+#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_MOCK_AFFILIATED_MATCH_HELPER_H_ |