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.
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_
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"
16 // This class is for easier writing of tests.
17 class TestAutofillClient : public AutofillClient {
20 ~TestAutofillClient() override;
22 // AutofillClient implementation.
23 PersonalDataManager* GetPersonalDataManager() override;
24 scoped_refptr<AutofillWebDataService> GetDatabase() override;
25 PrefService* GetPrefs() override;
26 void HideRequestAutocompleteDialog() override;
27 void ShowAutofillSettings() override;
28 void ConfirmSaveCreditCard(const AutofillMetrics& metric_logger,
29 const base::Closure& save_card_callback) override;
30 void ShowRequestAutocompleteDialog(const FormData& form,
31 const GURL& source_url,
32 const ResultCallback& callback) override;
33 void ShowAutofillPopup(
34 const gfx::RectF& element_bounds,
35 base::i18n::TextDirection text_direction,
36 const std::vector<base::string16>& values,
37 const std::vector<base::string16>& labels,
38 const std::vector<base::string16>& icons,
39 const std::vector<int>& identifiers,
40 base::WeakPtr<AutofillPopupDelegate> delegate) override;
41 void UpdateAutofillPopupDataListValues(
42 const std::vector<base::string16>& values,
43 const std::vector<base::string16>& labels) override;
44 void HideAutofillPopup() override;
45 bool IsAutocompleteEnabled() override;
47 void DetectAccountCreationForms(
48 const std::vector<autofill::FormStructure*>& forms) override;
50 void DidFillOrPreviewField(const base::string16& autofilled_value,
51 const base::string16& profile_full_name) override;
53 void SetPrefs(scoped_ptr<PrefService> prefs) { prefs_ = prefs.Pass(); }
57 scoped_ptr<PrefService> prefs_;
59 DISALLOW_COPY_AND_ASSIGN(TestAutofillClient);
62 } // namespace autofill
64 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_