OLD | NEW |
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 web { | 16 namespace web { |
17 class PaymentRequest; | 17 class PaymentRequest; |
18 class PaymentShippingOption; | |
19 } // namespace web | 18 } // namespace web |
20 | 19 |
21 // PaymentRequest for use in tests. | 20 // PaymentRequest for use in tests. |
22 class TestPaymentRequest : public PaymentRequest { | 21 class TestPaymentRequest : public PaymentRequest { |
23 public: | 22 public: |
24 // |personal_data_manager| should not be null and should outlive this object. | 23 // |personal_data_manager| should not be null and should outlive this object. |
25 TestPaymentRequest(const web::PaymentRequest& web_payment_request, | 24 TestPaymentRequest(const web::PaymentRequest& web_payment_request, |
26 autofill::PersonalDataManager* personal_data_manager) | 25 autofill::PersonalDataManager* personal_data_manager) |
27 : PaymentRequest(web_payment_request, personal_data_manager) {} | 26 : PaymentRequest(web_payment_request, personal_data_manager) {} |
28 | 27 |
29 ~TestPaymentRequest() override{}; | 28 ~TestPaymentRequest() override{}; |
30 | 29 |
31 void SetRegionDataLoader(autofill::RegionDataLoader* region_data_loader) { | 30 void SetRegionDataLoader(autofill::RegionDataLoader* region_data_loader) { |
32 region_data_loader_ = region_data_loader; | 31 region_data_loader_ = region_data_loader; |
33 } | 32 } |
34 | 33 |
35 // Returns the web::PaymentRequest instance that was used to build this | |
36 // object. | |
37 web::PaymentRequest& web_payment_request() { return web_payment_request_; } | |
38 | |
39 // Removes all the shipping profiles. | |
40 void ClearShippingProfiles(); | |
41 | |
42 // Removes all the contact profiles. | |
43 void ClearContactProfiles(); | |
44 | |
45 // Removes all the credit cards. | |
46 void ClearCreditCards(); | |
47 | |
48 // Sets the currently selected shipping option for this PaymentRequest flow. | |
49 void set_selected_shipping_option(web::PaymentShippingOption* option) { | |
50 selected_shipping_option_ = option; | |
51 } | |
52 | |
53 // PaymentRequest | 34 // PaymentRequest |
54 autofill::RegionDataLoader* GetRegionDataLoader() override; | 35 autofill::RegionDataLoader* GetRegionDataLoader() override; |
55 | 36 |
56 private: | 37 private: |
57 // Not owned and must outlive this object. | 38 // Not owned and must outlive this object. |
58 autofill::RegionDataLoader* region_data_loader_; | 39 autofill::RegionDataLoader* region_data_loader_; |
59 | 40 |
60 DISALLOW_COPY_AND_ASSIGN(TestPaymentRequest); | 41 DISALLOW_COPY_AND_ASSIGN(TestPaymentRequest); |
61 }; | 42 }; |
62 | 43 |
63 #endif // IOS_CHROME_BROWSER_PAYMENTS_TEST_PAYMENT_REQUEST_H_ | 44 #endif // IOS_CHROME_BROWSER_PAYMENTS_TEST_PAYMENT_REQUEST_H_ |
OLD | NEW |