Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: components/autofill/core/browser/test_autofill_client.h

Issue 2740633002: [Autofill] Add upstreaming UKM (Closed)
Patch Set: Fix for Android and iOS Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/i18n/rtl.h" 14 #include "base/i18n/rtl.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "components/autofill/core/browser/autofill_client.h" 16 #include "components/autofill/core/browser/autofill_client.h"
17 #include "components/prefs/pref_service.h" 17 #include "components/prefs/pref_service.h"
18 #include "components/rappor/test_rappor_service.h" 18 #include "components/rappor/test_rappor_service.h"
19 #include "components/ukm/test_ukm_service.h"
19 #include "google_apis/gaia/fake_identity_provider.h" 20 #include "google_apis/gaia/fake_identity_provider.h"
20 #include "google_apis/gaia/fake_oauth2_token_service.h" 21 #include "google_apis/gaia/fake_oauth2_token_service.h"
21 22
22 namespace autofill { 23 namespace autofill {
23 24
24 // This class is for easier writing of tests. 25 // This class is for easier writing of tests.
25 class TestAutofillClient : public AutofillClient { 26 class TestAutofillClient : public AutofillClient {
26 public: 27 public:
27 TestAutofillClient(); 28 TestAutofillClient();
28 ~TestAutofillClient() override; 29 ~TestAutofillClient() override;
29 30
30 // AutofillClient implementation. 31 // AutofillClient implementation.
31 PersonalDataManager* GetPersonalDataManager() override; 32 PersonalDataManager* GetPersonalDataManager() override;
32 scoped_refptr<AutofillWebDataService> GetDatabase() override; 33 scoped_refptr<AutofillWebDataService> GetDatabase() override;
33 PrefService* GetPrefs() override; 34 PrefService* GetPrefs() override;
34 syncer::SyncService* GetSyncService() override; 35 syncer::SyncService* GetSyncService() override;
35 IdentityProvider* GetIdentityProvider() override; 36 IdentityProvider* GetIdentityProvider() override;
36 rappor::RapporServiceImpl* GetRapporServiceImpl() override; 37 rappor::RapporServiceImpl* GetRapporServiceImpl() override;
38 ukm::UkmService* GetUkmService() override;
37 void ShowAutofillSettings() override; 39 void ShowAutofillSettings() override;
38 void ShowUnmaskPrompt(const CreditCard& card, 40 void ShowUnmaskPrompt(const CreditCard& card,
39 UnmaskCardReason reason, 41 UnmaskCardReason reason,
40 base::WeakPtr<CardUnmaskDelegate> delegate) override; 42 base::WeakPtr<CardUnmaskDelegate> delegate) override;
41 void OnUnmaskVerificationResult(PaymentsRpcResult result) override; 43 void OnUnmaskVerificationResult(PaymentsRpcResult result) override;
42 void ConfirmSaveCreditCardLocally(const CreditCard& card, 44 void ConfirmSaveCreditCardLocally(const CreditCard& card,
43 const base::Closure& callback) override; 45 const base::Closure& callback) override;
44 void ConfirmSaveCreditCardToCloud( 46 void ConfirmSaveCreditCardToCloud(
45 const CreditCard& card, 47 const CreditCard& card,
46 std::unique_ptr<base::DictionaryValue> legal_message, 48 std::unique_ptr<base::DictionaryValue> legal_message,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 void SetPrefs(std::unique_ptr<PrefService> prefs) { 80 void SetPrefs(std::unique_ptr<PrefService> prefs) {
79 prefs_ = std::move(prefs); 81 prefs_ = std::move(prefs);
80 } 82 }
81 83
82 rappor::TestRapporServiceImpl* test_rappor_service() { 84 rappor::TestRapporServiceImpl* test_rappor_service() {
83 return rappor_service_.get(); 85 return rappor_service_.get();
84 } 86 }
85 87
86 void set_form_origin(const GURL& url) { form_origin_ = url; } 88 void set_form_origin(const GURL& url) { form_origin_ = url; }
87 89
90 ukm::TestUkmService* GetTestUkmService() {
91 return ukm_service_test_harness_.test_ukm_service();
92 }
93
88 private: 94 private:
89 // NULL by default. 95 // NULL by default.
90 std::unique_ptr<PrefService> prefs_; 96 std::unique_ptr<PrefService> prefs_;
91 std::unique_ptr<FakeOAuth2TokenService> token_service_; 97 std::unique_ptr<FakeOAuth2TokenService> token_service_;
92 std::unique_ptr<FakeIdentityProvider> identity_provider_; 98 std::unique_ptr<FakeIdentityProvider> identity_provider_;
93 std::unique_ptr<rappor::TestRapporServiceImpl> rappor_service_; 99 std::unique_ptr<rappor::TestRapporServiceImpl> rappor_service_;
100 ukm::UkmServiceTestingHarness ukm_service_test_harness_;
94 GURL form_origin_; 101 GURL form_origin_;
95 102
96 DISALLOW_COPY_AND_ASSIGN(TestAutofillClient); 103 DISALLOW_COPY_AND_ASSIGN(TestAutofillClient);
97 }; 104 };
98 105
99 } // namespace autofill 106 } // namespace autofill
100 107
101 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ 108 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698