| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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; | 29 class PrefService; |
| 30 | 30 |
| 31 namespace payments { |
| 32 |
| 31 // PaymentRequest for use in tests. | 33 // PaymentRequest for use in tests. |
| 32 class TestPaymentRequest : public PaymentRequest { | 34 class TestPaymentRequest : public PaymentRequest { |
| 33 public: | 35 public: |
| 34 // |personal_data_manager| should not be null and should outlive this object. | 36 // |personal_data_manager| should not be null and should outlive this object. |
| 35 TestPaymentRequest(const web::PaymentRequest& web_payment_request, | 37 TestPaymentRequest(const web::PaymentRequest& web_payment_request, |
| 36 ios::ChromeBrowserState* browser_state, | 38 ios::ChromeBrowserState* browser_state, |
| 37 autofill::PersonalDataManager* personal_data_manager, | 39 autofill::PersonalDataManager* personal_data_manager, |
| 38 id<PaymentRequestUIDelegate> payment_request_ui_delegate) | 40 id<PaymentRequestUIDelegate> payment_request_ui_delegate) |
| 39 : PaymentRequest(web_payment_request, | 41 : PaymentRequest(web_payment_request, |
| 40 browser_state, | 42 browser_state, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 62 ~TestPaymentRequest() override {} | 64 ~TestPaymentRequest() override {} |
| 63 | 65 |
| 64 void SetRegionDataLoader(autofill::RegionDataLoader* region_data_loader) { | 66 void SetRegionDataLoader(autofill::RegionDataLoader* region_data_loader) { |
| 65 region_data_loader_ = region_data_loader; | 67 region_data_loader_ = region_data_loader; |
| 66 } | 68 } |
| 67 | 69 |
| 68 void SetPrefService(PrefService* pref_service) { | 70 void SetPrefService(PrefService* pref_service) { |
| 69 pref_service_ = pref_service; | 71 pref_service_ = pref_service; |
| 70 } | 72 } |
| 71 | 73 |
| 72 void SetProfileComparator( | 74 void SetProfileComparator(PaymentsProfileComparator* profile_comparator) { |
| 73 payments::PaymentsProfileComparator* profile_comparator) { | |
| 74 profile_comparator_ = profile_comparator; | 75 profile_comparator_ = profile_comparator; |
| 75 } | 76 } |
| 76 | 77 |
| 77 // Returns the web::PaymentRequest instance that was used to build this | 78 // Returns the web::PaymentRequest instance that was used to build this |
| 78 // object. | 79 // object. |
| 79 web::PaymentRequest& web_payment_request() { return web_payment_request_; } | 80 web::PaymentRequest& web_payment_request() { return web_payment_request_; } |
| 80 | 81 |
| 81 // Removes all the shipping profiles. | 82 // Removes all the shipping profiles. |
| 82 void ClearShippingProfiles(); | 83 void ClearShippingProfiles(); |
| 83 | 84 |
| 84 // Removes all the contact profiles. | 85 // Removes all the contact profiles. |
| 85 void ClearContactProfiles(); | 86 void ClearContactProfiles(); |
| 86 | 87 |
| 87 // Removes all the payment methods. | 88 // Removes all the payment methods. |
| 88 void ClearPaymentMethods(); | 89 void ClearPaymentMethods(); |
| 89 | 90 |
| 90 // Sets the currently selected shipping option for this PaymentRequest flow. | 91 // Sets the currently selected shipping option for this PaymentRequest flow. |
| 91 void set_selected_shipping_option(web::PaymentShippingOption* option) { | 92 void set_selected_shipping_option(web::PaymentShippingOption* option) { |
| 92 selected_shipping_option_ = option; | 93 selected_shipping_option_ = option; |
| 93 } | 94 } |
| 94 | 95 |
| 95 // PaymentRequest | 96 // PaymentRequest |
| 96 autofill::RegionDataLoader* GetRegionDataLoader() override; | 97 autofill::RegionDataLoader* GetRegionDataLoader() override; |
| 97 PrefService* GetPrefService() override; | 98 PrefService* GetPrefService() override; |
| 98 payments::PaymentsProfileComparator* profile_comparator() override; | 99 PaymentsProfileComparator* profile_comparator() override; |
| 99 | 100 |
| 100 private: | 101 private: |
| 101 // Not owned and must outlive this object. | 102 // Not owned and must outlive this object. |
| 102 autofill::RegionDataLoader* region_data_loader_; | 103 autofill::RegionDataLoader* region_data_loader_; |
| 103 | 104 |
| 104 // Not owned and must outlive this object. | 105 // Not owned and must outlive this object. |
| 105 PrefService* pref_service_; | 106 PrefService* pref_service_; |
| 106 | 107 |
| 107 // Not owned and must outlive this object. | 108 // Not owned and must outlive this object. |
| 108 payments::PaymentsProfileComparator* profile_comparator_; | 109 PaymentsProfileComparator* profile_comparator_; |
| 109 | 110 |
| 110 DISALLOW_COPY_AND_ASSIGN(TestPaymentRequest); | 111 DISALLOW_COPY_AND_ASSIGN(TestPaymentRequest); |
| 111 }; | 112 }; |
| 112 | 113 |
| 114 } // namespace payments |
| 115 |
| 113 #endif // IOS_CHROME_BROWSER_PAYMENTS_TEST_PAYMENT_REQUEST_H_ | 116 #endif // IOS_CHROME_BROWSER_PAYMENTS_TEST_PAYMENT_REQUEST_H_ |
| OLD | NEW |