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; | |
18 } // namespace web | 19 } // namespace web |
19 | 20 |
20 // PaymentRequest for use in tests. | 21 // PaymentRequest for use in tests. |
21 class TestPaymentRequest : public PaymentRequest { | 22 class TestPaymentRequest : public PaymentRequest { |
22 public: | 23 public: |
23 // |personal_data_manager| should not be null and should outlive this object. | 24 // |personal_data_manager| should not be null and should outlive this object. |
24 TestPaymentRequest(const web::PaymentRequest& web_payment_request, | 25 TestPaymentRequest(const web::PaymentRequest& web_payment_request, |
25 autofill::PersonalDataManager* personal_data_manager) | 26 autofill::PersonalDataManager* personal_data_manager) |
26 : PaymentRequest(web_payment_request, personal_data_manager) {} | 27 : PaymentRequest(web_payment_request, personal_data_manager) {} |
27 | 28 |
28 ~TestPaymentRequest() override{}; | 29 ~TestPaymentRequest() override{}; |
29 | 30 |
30 void SetRegionDataLoader(autofill::RegionDataLoader* region_data_loader) { | 31 void SetRegionDataLoader(autofill::RegionDataLoader* region_data_loader) { |
31 region_data_loader_ = region_data_loader; | 32 region_data_loader_ = region_data_loader; |
32 } | 33 } |
33 | 34 |
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 creidt cards. | |
lpromero
2017/06/06 09:43:54
*credit
Moe
2017/06/07 02:12:51
Done.
| |
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 | |
34 // PaymentRequest | 53 // PaymentRequest |
35 autofill::RegionDataLoader* GetRegionDataLoader() override; | 54 autofill::RegionDataLoader* GetRegionDataLoader() override; |
36 | 55 |
37 private: | 56 private: |
38 // Not owned and must outlive this object. | 57 // Not owned and must outlive this object. |
39 autofill::RegionDataLoader* region_data_loader_; | 58 autofill::RegionDataLoader* region_data_loader_; |
40 | 59 |
41 DISALLOW_COPY_AND_ASSIGN(TestPaymentRequest); | 60 DISALLOW_COPY_AND_ASSIGN(TestPaymentRequest); |
42 }; | 61 }; |
43 | 62 |
44 #endif // IOS_CHROME_BROWSER_PAYMENTS_TEST_PAYMENT_REQUEST_H_ | 63 #endif // IOS_CHROME_BROWSER_PAYMENTS_TEST_PAYMENT_REQUEST_H_ |
OLD | NEW |