| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_MOCK_PASSWORD_STORE_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_MOCK_PASSWORD_STORE_H_ |
| 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_MOCK_PASSWORD_STORE_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_MOCK_PASSWORD_STORE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "components/autofill/core/common/password_form.h" | 11 #include "components/autofill/core/common/password_form.h" |
| 12 #include "components/password_manager/core/browser/password_store.h" | 12 #include "components/password_manager/core/browser/password_store.h" |
| 13 #include "components/password_manager/core/browser/statistics_table.h" | 13 #include "components/password_manager/core/browser/statistics_table.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 15 #include "url/origin.h" | 15 #include "url/origin.h" |
| 16 | 16 |
| 17 namespace password_manager { | 17 namespace password_manager { |
| 18 | 18 |
| 19 class MockPasswordStore : public PasswordStore { | 19 class MockPasswordStore : public PasswordStore { |
| 20 public: | 20 public: |
| 21 MockPasswordStore(); | 21 MockPasswordStore(); |
| 22 | 22 |
| 23 MOCK_METHOD1(RemoveLogin, void(const autofill::PasswordForm&)); | 23 MOCK_METHOD1(RemoveLogin, void(const autofill::PasswordForm&)); |
| 24 MOCK_METHOD3(GetLogins, | 24 MOCK_METHOD2(GetLogins, |
| 25 void(const autofill::PasswordForm&, | 25 void(const autofill::PasswordForm&, PasswordStoreConsumer*)); |
| 26 PasswordStore::AuthorizationPromptPolicy prompt_policy, | |
| 27 PasswordStoreConsumer*)); | |
| 28 MOCK_METHOD1(AddLogin, void(const autofill::PasswordForm&)); | 26 MOCK_METHOD1(AddLogin, void(const autofill::PasswordForm&)); |
| 29 MOCK_METHOD1(UpdateLogin, void(const autofill::PasswordForm&)); | 27 MOCK_METHOD1(UpdateLogin, void(const autofill::PasswordForm&)); |
| 30 MOCK_METHOD2(UpdateLoginWithPrimaryKey, | 28 MOCK_METHOD2(UpdateLoginWithPrimaryKey, |
| 31 void(const autofill::PasswordForm&, | 29 void(const autofill::PasswordForm&, |
| 32 const autofill::PasswordForm&)); | 30 const autofill::PasswordForm&)); |
| 33 MOCK_METHOD2(ReportMetrics, void(const std::string&, bool)); | 31 MOCK_METHOD2(ReportMetrics, void(const std::string&, bool)); |
| 34 MOCK_METHOD2(ReportMetricsImpl, void(const std::string&, bool)); | 32 MOCK_METHOD2(ReportMetricsImpl, void(const std::string&, bool)); |
| 35 MOCK_METHOD1(AddLoginImpl, | 33 MOCK_METHOD1(AddLoginImpl, |
| 36 PasswordStoreChangeList(const autofill::PasswordForm&)); | 34 PasswordStoreChangeList(const autofill::PasswordForm&)); |
| 37 MOCK_METHOD1(UpdateLoginImpl, | 35 MOCK_METHOD1(UpdateLoginImpl, |
| 38 PasswordStoreChangeList(const autofill::PasswordForm&)); | 36 PasswordStoreChangeList(const autofill::PasswordForm&)); |
| 39 MOCK_METHOD1(RemoveLoginImpl, | 37 MOCK_METHOD1(RemoveLoginImpl, |
| 40 PasswordStoreChangeList(const autofill::PasswordForm&)); | 38 PasswordStoreChangeList(const autofill::PasswordForm&)); |
| 41 MOCK_METHOD3(RemoveLoginsByOriginAndTimeImpl, | 39 MOCK_METHOD3(RemoveLoginsByOriginAndTimeImpl, |
| 42 PasswordStoreChangeList(const url::Origin&, | 40 PasswordStoreChangeList(const url::Origin&, |
| 43 base::Time, | 41 base::Time, |
| 44 base::Time)); | 42 base::Time)); |
| 45 MOCK_METHOD2(RemoveLoginsCreatedBetweenImpl, | 43 MOCK_METHOD2(RemoveLoginsCreatedBetweenImpl, |
| 46 PasswordStoreChangeList(base::Time, base::Time)); | 44 PasswordStoreChangeList(base::Time, base::Time)); |
| 47 MOCK_METHOD2(RemoveLoginsSyncedBetweenImpl, | 45 MOCK_METHOD2(RemoveLoginsSyncedBetweenImpl, |
| 48 PasswordStoreChangeList(base::Time, base::Time)); | 46 PasswordStoreChangeList(base::Time, base::Time)); |
| 49 MOCK_METHOD2(RemoveStatisticsCreatedBetweenImpl, | 47 MOCK_METHOD2(RemoveStatisticsCreatedBetweenImpl, |
| 50 bool(base::Time, base::Time)); | 48 bool(base::Time, base::Time)); |
| 51 ScopedVector<autofill::PasswordForm> FillMatchingLogins( | 49 ScopedVector<autofill::PasswordForm> FillMatchingLogins( |
| 52 const autofill::PasswordForm& form, | 50 const autofill::PasswordForm& form) override { |
| 53 PasswordStore::AuthorizationPromptPolicy prompt_policy) override { | |
| 54 return ScopedVector<autofill::PasswordForm>(); | 51 return ScopedVector<autofill::PasswordForm>(); |
| 55 } | 52 } |
| 56 MOCK_METHOD1(FillAutofillableLogins, | 53 MOCK_METHOD1(FillAutofillableLogins, |
| 57 bool(ScopedVector<autofill::PasswordForm>*)); | 54 bool(ScopedVector<autofill::PasswordForm>*)); |
| 58 MOCK_METHOD1(FillBlacklistLogins, | 55 MOCK_METHOD1(FillBlacklistLogins, |
| 59 bool(ScopedVector<autofill::PasswordForm>*)); | 56 bool(ScopedVector<autofill::PasswordForm>*)); |
| 60 MOCK_METHOD1(NotifyLoginsChanged, void(const PasswordStoreChangeList&)); | 57 MOCK_METHOD1(NotifyLoginsChanged, void(const PasswordStoreChangeList&)); |
| 61 // GMock doesn't allow to return noncopyable types. | 58 // GMock doesn't allow to return noncopyable types. |
| 62 std::vector<scoped_ptr<InteractionsStats>> GetSiteStatsImpl( | 59 std::vector<scoped_ptr<InteractionsStats>> GetSiteStatsImpl( |
| 63 const GURL& origin_domain) override; | 60 const GURL& origin_domain) override; |
| 64 MOCK_METHOD1(GetSiteStatsMock, std::vector<InteractionsStats*>(const GURL&)); | 61 MOCK_METHOD1(GetSiteStatsMock, std::vector<InteractionsStats*>(const GURL&)); |
| 65 MOCK_METHOD1(AddSiteStatsImpl, void(const InteractionsStats&)); | 62 MOCK_METHOD1(AddSiteStatsImpl, void(const InteractionsStats&)); |
| 66 MOCK_METHOD1(RemoveSiteStatsImpl, void(const GURL&)); | 63 MOCK_METHOD1(RemoveSiteStatsImpl, void(const GURL&)); |
| 67 | 64 |
| 68 PasswordStoreSync* GetSyncInterface() { return this; } | 65 PasswordStoreSync* GetSyncInterface() { return this; } |
| 69 | 66 |
| 70 protected: | 67 protected: |
| 71 virtual ~MockPasswordStore(); | 68 virtual ~MockPasswordStore(); |
| 72 }; | 69 }; |
| 73 | 70 |
| 74 } // namespace password_manager | 71 } // namespace password_manager |
| 75 | 72 |
| 76 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_MOCK_PASSWORD_STORE_H_ | 73 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_MOCK_PASSWORD_STORE_H_ |
| OLD | NEW |