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