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