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