| 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 <utility> | 9 #include <utility> |
| 9 | 10 |
| 10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 11 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "components/autofill/core/browser/autofill_client.h" | 14 #include "components/autofill/core/browser/autofill_client.h" |
| 15 #include "components/prefs/pref_service.h" | 15 #include "components/prefs/pref_service.h" |
| 16 #include "components/rappor/test_rappor_service.h" | 16 #include "components/rappor/test_rappor_service.h" |
| 17 #include "google_apis/gaia/fake_identity_provider.h" | 17 #include "google_apis/gaia/fake_identity_provider.h" |
| 18 #include "google_apis/gaia/fake_oauth2_token_service.h" | 18 #include "google_apis/gaia/fake_oauth2_token_service.h" |
| 19 | 19 |
| 20 namespace autofill { | 20 namespace autofill { |
| 21 | 21 |
| 22 // This class is for easier writing of tests. | 22 // This class is for easier writing of tests. |
| 23 class TestAutofillClient : public AutofillClient { | 23 class TestAutofillClient : public AutofillClient { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 rappor::RapporService* GetRapporService() override; | 34 rappor::RapporService* GetRapporService() override; |
| 35 void HideRequestAutocompleteDialog() override; | 35 void HideRequestAutocompleteDialog() override; |
| 36 void ShowAutofillSettings() override; | 36 void ShowAutofillSettings() override; |
| 37 void ShowUnmaskPrompt(const CreditCard& card, | 37 void ShowUnmaskPrompt(const CreditCard& card, |
| 38 base::WeakPtr<CardUnmaskDelegate> delegate) override; | 38 base::WeakPtr<CardUnmaskDelegate> delegate) override; |
| 39 void OnUnmaskVerificationResult(PaymentsRpcResult result) override; | 39 void OnUnmaskVerificationResult(PaymentsRpcResult result) override; |
| 40 void ConfirmSaveCreditCardLocally(const CreditCard& card, | 40 void ConfirmSaveCreditCardLocally(const CreditCard& card, |
| 41 const base::Closure& callback) override; | 41 const base::Closure& callback) override; |
| 42 void ConfirmSaveCreditCardToCloud( | 42 void ConfirmSaveCreditCardToCloud( |
| 43 const CreditCard& card, | 43 const CreditCard& card, |
| 44 scoped_ptr<base::DictionaryValue> legal_message, | 44 std::unique_ptr<base::DictionaryValue> legal_message, |
| 45 const base::Closure& callback) override; | 45 const base::Closure& callback) override; |
| 46 void LoadRiskData( | 46 void LoadRiskData( |
| 47 const base::Callback<void(const std::string&)>& callback) override; | 47 const base::Callback<void(const std::string&)>& callback) override; |
| 48 bool HasCreditCardScanFeature() override; | 48 bool HasCreditCardScanFeature() override; |
| 49 void ScanCreditCard(const CreditCardScanCallback& callback) override; | 49 void ScanCreditCard(const CreditCardScanCallback& callback) override; |
| 50 void ShowRequestAutocompleteDialog(const FormData& form, | 50 void ShowRequestAutocompleteDialog(const FormData& form, |
| 51 content::RenderFrameHost* rfh, | 51 content::RenderFrameHost* rfh, |
| 52 const ResultCallback& callback) override; | 52 const ResultCallback& callback) override; |
| 53 void ShowAutofillPopup( | 53 void ShowAutofillPopup( |
| 54 const gfx::RectF& element_bounds, | 54 const gfx::RectF& element_bounds, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 65 const std::vector<autofill::FormStructure*>& forms) override; | 65 const std::vector<autofill::FormStructure*>& forms) override; |
| 66 void DidFillOrPreviewField(const base::string16& autofilled_value, | 66 void DidFillOrPreviewField(const base::string16& autofilled_value, |
| 67 const base::string16& profile_full_name) override; | 67 const base::string16& profile_full_name) override; |
| 68 void OnFirstUserGestureObserved() override; | 68 void OnFirstUserGestureObserved() override; |
| 69 bool IsContextSecure(const GURL& form_origin) override; | 69 bool IsContextSecure(const GURL& form_origin) override; |
| 70 | 70 |
| 71 void set_is_context_secure(bool is_context_secure) { | 71 void set_is_context_secure(bool is_context_secure) { |
| 72 is_context_secure_ = is_context_secure; | 72 is_context_secure_ = is_context_secure; |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 void SetPrefs(scoped_ptr<PrefService> prefs) { prefs_ = std::move(prefs); } | 75 void SetPrefs(std::unique_ptr<PrefService> prefs) { |
| 76 prefs_ = std::move(prefs); |
| 77 } |
| 76 | 78 |
| 77 rappor::TestRapporService* test_rappor_service() { | 79 rappor::TestRapporService* test_rappor_service() { |
| 78 return rappor_service_.get(); | 80 return rappor_service_.get(); |
| 79 } | 81 } |
| 80 | 82 |
| 81 private: | 83 private: |
| 82 // NULL by default. | 84 // NULL by default. |
| 83 scoped_ptr<PrefService> prefs_; | 85 std::unique_ptr<PrefService> prefs_; |
| 84 scoped_ptr<FakeOAuth2TokenService> token_service_; | 86 std::unique_ptr<FakeOAuth2TokenService> token_service_; |
| 85 scoped_ptr<FakeIdentityProvider> identity_provider_; | 87 std::unique_ptr<FakeIdentityProvider> identity_provider_; |
| 86 scoped_ptr<rappor::TestRapporService> rappor_service_; | 88 std::unique_ptr<rappor::TestRapporService> rappor_service_; |
| 87 | 89 |
| 88 bool is_context_secure_; | 90 bool is_context_secure_; |
| 89 | 91 |
| 90 DISALLOW_COPY_AND_ASSIGN(TestAutofillClient); | 92 DISALLOW_COPY_AND_ASSIGN(TestAutofillClient); |
| 91 }; | 93 }; |
| 92 | 94 |
| 93 } // namespace autofill | 95 } // namespace autofill |
| 94 | 96 |
| 95 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ | 97 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ |
| OLD | NEW |