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"
13 #include "google_apis/gaia/fake_identity_provider.h"
14 #include "google_apis/gaia/fake_oauth2_token_service.h"
18 // This class is for easier writing of tests.
19 class TestAutofillClient
: public AutofillClient
{
22 ~TestAutofillClient() override
;
24 // AutofillClient implementation.
25 PersonalDataManager
* GetPersonalDataManager() override
;
26 scoped_refptr
<AutofillWebDataService
> GetDatabase() override
;
27 PrefService
* GetPrefs() override
;
28 IdentityProvider
* GetIdentityProvider() override
;
29 void HideRequestAutocompleteDialog() override
;
30 void ShowAutofillSettings() override
;
31 void ShowUnmaskPrompt(const CreditCard
& card
,
32 base::WeakPtr
<CardUnmaskDelegate
> delegate
) override
;
33 void OnUnmaskVerificationResult(GetRealPanResult result
) override
;
34 void ConfirmSaveCreditCard(const base::Closure
& save_card_callback
) override
;
35 bool HasCreditCardScanFeature() override
;
36 void ScanCreditCard(const CreditCardScanCallback
& callback
) override
;
37 void ShowRequestAutocompleteDialog(const FormData
& form
,
38 content::RenderFrameHost
* rfh
,
39 const ResultCallback
& callback
) override
;
40 void ShowAutofillPopup(
41 const gfx::RectF
& element_bounds
,
42 base::i18n::TextDirection text_direction
,
43 const std::vector
<Suggestion
>& suggestions
,
44 base::WeakPtr
<AutofillPopupDelegate
> delegate
) override
;
45 void UpdateAutofillPopupDataListValues(
46 const std::vector
<base::string16
>& values
,
47 const std::vector
<base::string16
>& labels
) override
;
48 void HideAutofillPopup() override
;
49 bool IsAutocompleteEnabled() override
;
50 void DetectAccountCreationForms(
51 content::RenderFrameHost
* rfh
,
52 const std::vector
<autofill::FormStructure
*>& forms
) override
;
53 void DidFillOrPreviewField(const base::string16
& autofilled_value
,
54 const base::string16
& profile_full_name
) override
;
55 void OnFirstUserGestureObserved() override
;
56 void LinkClicked(const GURL
& url
, WindowOpenDisposition disposition
) override
;
58 void SetPrefs(scoped_ptr
<PrefService
> prefs
) { prefs_
= prefs
.Pass(); }
62 scoped_ptr
<PrefService
> prefs_
;
63 scoped_ptr
<FakeOAuth2TokenService
> token_service_
;
64 scoped_ptr
<FakeIdentityProvider
> identity_provider_
;
66 DISALLOW_COPY_AND_ASSIGN(TestAutofillClient
);
69 } // namespace autofill
71 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_