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