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

Side by Side Diff: ios/chrome/browser/payments/test_payment_request.h

Issue 2970013003: [Payment Request] Displays appropriate footer if first transaction completed (Closed)
Patch Set: Addressed comments + rebase Created 3 years, 5 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 IOS_CHROME_BROWSER_PAYMENTS_TEST_PAYMENT_REQUEST_H_ 5 #ifndef IOS_CHROME_BROWSER_PAYMENTS_TEST_PAYMENT_REQUEST_H_
6 #define IOS_CHROME_BROWSER_PAYMENTS_TEST_PAYMENT_REQUEST_H_ 6 #define IOS_CHROME_BROWSER_PAYMENTS_TEST_PAYMENT_REQUEST_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "ios/chrome/browser/payments/payment_request.h" 9 #include "ios/chrome/browser/payments/payment_request.h"
10 10
11 namespace autofill { 11 namespace autofill {
12 class PersonalDataManager; 12 class PersonalDataManager;
13 class RegionDataLoader; 13 class RegionDataLoader;
14 } // namespace autofill 14 } // namespace autofill
15 15
16 namespace ios { 16 namespace ios {
17 class ChromeBrowserState; 17 class ChromeBrowserState;
18 } // namespace ios 18 } // namespace ios
19 19
20 namespace payments { 20 namespace payments {
21 class PaymentsProfileComparator; 21 class PaymentsProfileComparator;
22 } // namespace payments 22 } // namespace payments
23 23
24 namespace web { 24 namespace web {
25 class PaymentRequest; 25 class PaymentRequest;
26 class PaymentShippingOption; 26 class PaymentShippingOption;
27 } // namespace web 27 } // namespace web
28 28
29 class PrefService;
30
29 // PaymentRequest for use in tests. 31 // PaymentRequest for use in tests.
30 class TestPaymentRequest : public PaymentRequest { 32 class TestPaymentRequest : public PaymentRequest {
31 public: 33 public:
32 // |personal_data_manager| should not be null and should outlive this object. 34 // |personal_data_manager| should not be null and should outlive this object.
33 TestPaymentRequest(const web::PaymentRequest& web_payment_request, 35 TestPaymentRequest(const web::PaymentRequest& web_payment_request,
34 ios::ChromeBrowserState* browser_state, 36 ios::ChromeBrowserState* browser_state,
35 autofill::PersonalDataManager* personal_data_manager, 37 autofill::PersonalDataManager* personal_data_manager,
36 id<PaymentRequestUIDelegate> payment_request_ui_delegate) 38 id<PaymentRequestUIDelegate> payment_request_ui_delegate)
37 : PaymentRequest(web_payment_request, 39 : PaymentRequest(web_payment_request,
38 browser_state, 40 browser_state,
39 personal_data_manager, 41 personal_data_manager,
40 payment_request_ui_delegate), 42 payment_request_ui_delegate),
41 region_data_loader_(nullptr), 43 region_data_loader_(nullptr),
44 pref_service_(nullptr),
42 profile_comparator_(nullptr) {} 45 profile_comparator_(nullptr) {}
43 46
44 TestPaymentRequest(const web::PaymentRequest& web_payment_request, 47 TestPaymentRequest(const web::PaymentRequest& web_payment_request,
48 ios::ChromeBrowserState* browser_state,
49 autofill::PersonalDataManager* personal_data_manager)
50 : TestPaymentRequest(web_payment_request,
51 browser_state,
52 personal_data_manager,
53 nil) {}
54
55 TestPaymentRequest(const web::PaymentRequest& web_payment_request,
45 autofill::PersonalDataManager* personal_data_manager) 56 autofill::PersonalDataManager* personal_data_manager)
46 : TestPaymentRequest(web_payment_request, 57 : TestPaymentRequest(web_payment_request,
47 nil, 58 nil,
48 personal_data_manager, 59 personal_data_manager,
49 nil) {} 60 nil) {}
50 61
51 ~TestPaymentRequest() override {} 62 ~TestPaymentRequest() override {}
52 63
53 void SetRegionDataLoader(autofill::RegionDataLoader* region_data_loader) { 64 void SetRegionDataLoader(autofill::RegionDataLoader* region_data_loader) {
54 region_data_loader_ = region_data_loader; 65 region_data_loader_ = region_data_loader;
55 } 66 }
56 67
68 void SetPrefService(PrefService* pref_service) {
69 pref_service_ = pref_service;
70 }
71
57 void SetProfileComparator( 72 void SetProfileComparator(
58 payments::PaymentsProfileComparator* profile_comparator) { 73 payments::PaymentsProfileComparator* profile_comparator) {
59 profile_comparator_ = profile_comparator; 74 profile_comparator_ = profile_comparator;
60 } 75 }
61 76
62 // Returns the web::PaymentRequest instance that was used to build this 77 // Returns the web::PaymentRequest instance that was used to build this
63 // object. 78 // object.
64 web::PaymentRequest& web_payment_request() { return web_payment_request_; } 79 web::PaymentRequest& web_payment_request() { return web_payment_request_; }
65 80
66 // Removes all the shipping profiles. 81 // Removes all the shipping profiles.
67 void ClearShippingProfiles(); 82 void ClearShippingProfiles();
68 83
69 // Removes all the contact profiles. 84 // Removes all the contact profiles.
70 void ClearContactProfiles(); 85 void ClearContactProfiles();
71 86
72 // Removes all the credit cards. 87 // Removes all the credit cards.
73 void ClearCreditCards(); 88 void ClearCreditCards();
74 89
75 // Sets the currently selected shipping option for this PaymentRequest flow. 90 // Sets the currently selected shipping option for this PaymentRequest flow.
76 void set_selected_shipping_option(web::PaymentShippingOption* option) { 91 void set_selected_shipping_option(web::PaymentShippingOption* option) {
77 selected_shipping_option_ = option; 92 selected_shipping_option_ = option;
78 } 93 }
79 94
80 // PaymentRequest 95 // PaymentRequest
81 autofill::RegionDataLoader* GetRegionDataLoader() override; 96 autofill::RegionDataLoader* GetRegionDataLoader() override;
97 PrefService* GetPrefService() override;
82 payments::PaymentsProfileComparator* profile_comparator() override; 98 payments::PaymentsProfileComparator* profile_comparator() override;
83 99
84 private: 100 private:
85 // Not owned and must outlive this object. 101 // Not owned and must outlive this object.
86 autofill::RegionDataLoader* region_data_loader_; 102 autofill::RegionDataLoader* region_data_loader_;
87 103
88 // Not owned and must outlive this object. 104 // Not owned and must outlive this object.
105 PrefService* pref_service_;
106
107 // Not owned and must outlive this object.
89 payments::PaymentsProfileComparator* profile_comparator_; 108 payments::PaymentsProfileComparator* profile_comparator_;
90 109
91 DISALLOW_COPY_AND_ASSIGN(TestPaymentRequest); 110 DISALLOW_COPY_AND_ASSIGN(TestPaymentRequest);
92 }; 111 };
93 112
94 #endif // IOS_CHROME_BROWSER_PAYMENTS_TEST_PAYMENT_REQUEST_H_ 113 #endif // IOS_CHROME_BROWSER_PAYMENTS_TEST_PAYMENT_REQUEST_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/payments/payment_request.mm ('k') | ios/chrome/browser/payments/test_payment_request.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698