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 "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "components/autofill/core/browser/autofill_client.h" | 12 #include "components/autofill/core/browser/autofill_client.h" |
13 | 13 |
14 namespace autofill { | 14 namespace autofill { |
15 | 15 |
16 // This class is for easier writing of tests. | 16 // This class is for easier writing of tests. |
17 class TestAutofillClient : public AutofillClient { | 17 class TestAutofillClient : public AutofillClient { |
18 public: | 18 public: |
19 TestAutofillClient(); | 19 TestAutofillClient(); |
20 virtual ~TestAutofillClient(); | 20 ~TestAutofillClient() override; |
21 | 21 |
22 // AutofillClient implementation. | 22 // AutofillClient implementation. |
23 virtual PersonalDataManager* GetPersonalDataManager() override; | 23 PersonalDataManager* GetPersonalDataManager() override; |
24 virtual scoped_refptr<AutofillWebDataService> GetDatabase() override; | 24 scoped_refptr<AutofillWebDataService> GetDatabase() override; |
25 virtual PrefService* GetPrefs() override; | 25 PrefService* GetPrefs() override; |
26 virtual void HideRequestAutocompleteDialog() override; | 26 void HideRequestAutocompleteDialog() override; |
27 virtual void ShowAutofillSettings() override; | 27 void ShowAutofillSettings() override; |
28 virtual void ConfirmSaveCreditCard( | 28 void ConfirmSaveCreditCard(const AutofillMetrics& metric_logger, |
29 const AutofillMetrics& metric_logger, | 29 const base::Closure& save_card_callback) override; |
30 const base::Closure& save_card_callback) override; | 30 void ShowRequestAutocompleteDialog(const FormData& form, |
31 virtual void ShowRequestAutocompleteDialog( | 31 const GURL& source_url, |
32 const FormData& form, | 32 const ResultCallback& callback) override; |
33 const GURL& source_url, | 33 void ShowAutofillPopup( |
34 const ResultCallback& callback) override; | |
35 virtual void ShowAutofillPopup( | |
36 const gfx::RectF& element_bounds, | 34 const gfx::RectF& element_bounds, |
37 base::i18n::TextDirection text_direction, | 35 base::i18n::TextDirection text_direction, |
38 const std::vector<base::string16>& values, | 36 const std::vector<base::string16>& values, |
39 const std::vector<base::string16>& labels, | 37 const std::vector<base::string16>& labels, |
40 const std::vector<base::string16>& icons, | 38 const std::vector<base::string16>& icons, |
41 const std::vector<int>& identifiers, | 39 const std::vector<int>& identifiers, |
42 base::WeakPtr<AutofillPopupDelegate> delegate) override; | 40 base::WeakPtr<AutofillPopupDelegate> delegate) override; |
43 virtual void UpdateAutofillPopupDataListValues( | 41 void UpdateAutofillPopupDataListValues( |
44 const std::vector<base::string16>& values, | 42 const std::vector<base::string16>& values, |
45 const std::vector<base::string16>& labels) override; | 43 const std::vector<base::string16>& labels) override; |
46 virtual void HideAutofillPopup() override; | 44 void HideAutofillPopup() override; |
47 virtual bool IsAutocompleteEnabled() override; | 45 bool IsAutocompleteEnabled() override; |
48 | 46 |
49 virtual void DetectAccountCreationForms( | 47 void DetectAccountCreationForms( |
50 const std::vector<autofill::FormStructure*>& forms) override; | 48 const std::vector<autofill::FormStructure*>& forms) override; |
51 | 49 |
52 virtual void DidFillOrPreviewField( | 50 void DidFillOrPreviewField(const base::string16& autofilled_value, |
53 const base::string16& autofilled_value, | 51 const base::string16& profile_full_name) override; |
54 const base::string16& profile_full_name) override; | |
55 | 52 |
56 void SetPrefs(scoped_ptr<PrefService> prefs) { prefs_ = prefs.Pass(); } | 53 void SetPrefs(scoped_ptr<PrefService> prefs) { prefs_ = prefs.Pass(); } |
57 | 54 |
58 private: | 55 private: |
59 // NULL by default. | 56 // NULL by default. |
60 scoped_ptr<PrefService> prefs_; | 57 scoped_ptr<PrefService> prefs_; |
61 | 58 |
62 DISALLOW_COPY_AND_ASSIGN(TestAutofillClient); | 59 DISALLOW_COPY_AND_ASSIGN(TestAutofillClient); |
63 }; | 60 }; |
64 | 61 |
65 } // namespace autofill | 62 } // namespace autofill |
66 | 63 |
67 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ | 64 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ |
OLD | NEW |