| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | |
| 10 #include <utility> | 9 #include <utility> |
| 11 #include <vector> | |
| 12 | 10 |
| 13 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 14 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
| 15 #include "base/macros.h" | 13 #include "base/macros.h" |
| 16 #include "components/autofill/core/browser/autofill_client.h" | 14 #include "components/autofill/core/browser/autofill_client.h" |
| 17 #include "components/prefs/pref_service.h" | 15 #include "components/prefs/pref_service.h" |
| 18 #include "components/rappor/test_rappor_service.h" | 16 #include "components/rappor/test_rappor_service.h" |
| 19 #include "google_apis/gaia/fake_identity_provider.h" | 17 #include "google_apis/gaia/fake_identity_provider.h" |
| 20 #include "google_apis/gaia/fake_oauth2_token_service.h" | 18 #include "google_apis/gaia/fake_oauth2_token_service.h" |
| 21 | 19 |
| 22 namespace autofill { | 20 namespace autofill { |
| 23 | 21 |
| 24 // This class is for easier writing of tests. | 22 // This class is for easier writing of tests. |
| 25 class TestAutofillClient : public AutofillClient { | 23 class TestAutofillClient : public AutofillClient { |
| 26 public: | 24 public: |
| 27 TestAutofillClient(); | 25 TestAutofillClient(); |
| 28 ~TestAutofillClient() override; | 26 ~TestAutofillClient() override; |
| 29 | 27 |
| 30 // AutofillClient implementation. | 28 // AutofillClient implementation. |
| 31 PersonalDataManager* GetPersonalDataManager() override; | 29 PersonalDataManager* GetPersonalDataManager() override; |
| 32 scoped_refptr<AutofillWebDataService> GetDatabase() override; | 30 scoped_refptr<AutofillWebDataService> GetDatabase() override; |
| 33 PrefService* GetPrefs() override; | 31 PrefService* GetPrefs() override; |
| 34 syncer::SyncService* GetSyncService() override; | 32 sync_driver::SyncService* GetSyncService() override; |
| 35 IdentityProvider* GetIdentityProvider() override; | 33 IdentityProvider* GetIdentityProvider() override; |
| 36 rappor::RapporService* GetRapporService() override; | 34 rappor::RapporService* GetRapporService() override; |
| 37 void ShowAutofillSettings() override; | 35 void ShowAutofillSettings() override; |
| 38 void ShowUnmaskPrompt(const CreditCard& card, | 36 void ShowUnmaskPrompt(const CreditCard& card, |
| 39 UnmaskCardReason reason, | 37 UnmaskCardReason reason, |
| 40 base::WeakPtr<CardUnmaskDelegate> delegate) override; | 38 base::WeakPtr<CardUnmaskDelegate> delegate) override; |
| 41 void OnUnmaskVerificationResult(PaymentsRpcResult result) override; | 39 void OnUnmaskVerificationResult(PaymentsRpcResult result) override; |
| 42 void ConfirmSaveCreditCardLocally(const CreditCard& card, | 40 void ConfirmSaveCreditCardLocally(const CreditCard& card, |
| 43 const base::Closure& callback) override; | 41 const base::Closure& callback) override; |
| 44 void ConfirmSaveCreditCardToCloud( | 42 void ConfirmSaveCreditCardToCloud( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 66 const std::vector<autofill::FormStructure*>& forms) override; | 64 const std::vector<autofill::FormStructure*>& forms) override; |
| 67 void DidFillOrPreviewField(const base::string16& autofilled_value, | 65 void DidFillOrPreviewField(const base::string16& autofilled_value, |
| 68 const base::string16& profile_full_name) override; | 66 const base::string16& profile_full_name) override; |
| 69 void OnFirstUserGestureObserved() override; | 67 void OnFirstUserGestureObserved() override; |
| 70 bool IsContextSecure(const GURL& form_origin) override; | 68 bool IsContextSecure(const GURL& form_origin) override; |
| 71 bool ShouldShowSigninPromo() override; | 69 bool ShouldShowSigninPromo() override; |
| 72 void StartSigninFlow() override; | 70 void StartSigninFlow() override; |
| 73 | 71 |
| 74 void set_is_context_secure(bool is_context_secure) { | 72 void set_is_context_secure(bool is_context_secure) { |
| 75 is_context_secure_ = is_context_secure; | 73 is_context_secure_ = is_context_secure; |
| 76 } | 74 }; |
| 77 | 75 |
| 78 void SetPrefs(std::unique_ptr<PrefService> prefs) { | 76 void SetPrefs(std::unique_ptr<PrefService> prefs) { |
| 79 prefs_ = std::move(prefs); | 77 prefs_ = std::move(prefs); |
| 80 } | 78 } |
| 81 | 79 |
| 82 rappor::TestRapporService* test_rappor_service() { | 80 rappor::TestRapporService* test_rappor_service() { |
| 83 return rappor_service_.get(); | 81 return rappor_service_.get(); |
| 84 } | 82 } |
| 85 | 83 |
| 86 private: | 84 private: |
| 87 // NULL by default. | 85 // NULL by default. |
| 88 std::unique_ptr<PrefService> prefs_; | 86 std::unique_ptr<PrefService> prefs_; |
| 89 std::unique_ptr<FakeOAuth2TokenService> token_service_; | 87 std::unique_ptr<FakeOAuth2TokenService> token_service_; |
| 90 std::unique_ptr<FakeIdentityProvider> identity_provider_; | 88 std::unique_ptr<FakeIdentityProvider> identity_provider_; |
| 91 std::unique_ptr<rappor::TestRapporService> rappor_service_; | 89 std::unique_ptr<rappor::TestRapporService> rappor_service_; |
| 92 | 90 |
| 93 bool is_context_secure_; | 91 bool is_context_secure_; |
| 94 | 92 |
| 95 DISALLOW_COPY_AND_ASSIGN(TestAutofillClient); | 93 DISALLOW_COPY_AND_ASSIGN(TestAutofillClient); |
| 96 }; | 94 }; |
| 97 | 95 |
| 98 } // namespace autofill | 96 } // namespace autofill |
| 99 | 97 |
| 100 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ | 98 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ |
| OLD | NEW |