| 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 #include "ios/chrome/browser/payments/payment_request_test_util.h" | 5 #include "ios/chrome/browser/payments/payment_request_test_util.h" |
| 6 | 6 |
| 7 #include "base/guid.h" | 7 #include "base/guid.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "components/autofill/core/browser/autofill_profile.h" | 10 #include "components/autofill/core/browser/autofill_profile.h" |
| 11 #include "components/autofill/core/browser/autofill_test_utils.h" | 11 #include "components/autofill/core/browser/autofill_test_utils.h" |
| 12 #include "components/autofill/core/browser/credit_card.h" | 12 #include "components/autofill/core/browser/credit_card.h" |
| 13 #include "components/autofill/core/browser/test_personal_data_manager.h" | 13 #include "components/autofill/core/browser/test_personal_data_manager.h" |
| 14 #include "ios/chrome/browser/payments/payment_request.h" | 14 #include "ios/chrome/browser/payments/payment_request.h" |
| 15 #include "ios/web/public/payments/payment_request.h" | 15 #include "ios/web/public/payments/payment_request.h" |
| 16 | 16 |
| 17 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 18 #error "This file requires ARC support." |
| 19 #endif |
| 20 |
| 17 namespace payment_request_test_util { | 21 namespace payment_request_test_util { |
| 18 | 22 |
| 19 web::PaymentRequest CreateTestWebPaymentRequest() { | 23 web::PaymentRequest CreateTestWebPaymentRequest() { |
| 20 web::PaymentRequest web_payment_request; | 24 web::PaymentRequest web_payment_request; |
| 21 web::PaymentMethodData method_datum; | 25 web::PaymentMethodData method_datum; |
| 22 method_datum.supported_methods.push_back(base::ASCIIToUTF16("visa")); | 26 method_datum.supported_methods.push_back(base::ASCIIToUTF16("visa")); |
| 23 web_payment_request.method_data.push_back(method_datum); | 27 web_payment_request.method_data.push_back(method_datum); |
| 24 web_payment_request.details.total.label = base::ASCIIToUTF16("Total"); | 28 web_payment_request.details.total.label = base::ASCIIToUTF16("Total"); |
| 25 web_payment_request.details.total.amount.value = base::ASCIIToUTF16("1.00"); | 29 web_payment_request.details.total.amount.value = base::ASCIIToUTF16("1.00"); |
| 26 web_payment_request.details.total.amount.currency = base::ASCIIToUTF16("USD"); | 30 web_payment_request.details.total.amount.currency = base::ASCIIToUTF16("USD"); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 personal_data_manager->AddTestingProfile(profile.get()); | 84 personal_data_manager->AddTestingProfile(profile.get()); |
| 81 | 85 |
| 82 web::PaymentRequest web_payment_request = CreateTestWebPaymentRequest(); | 86 web::PaymentRequest web_payment_request = CreateTestWebPaymentRequest(); |
| 83 | 87 |
| 84 return base::MakeUnique<PaymentRequest>( | 88 return base::MakeUnique<PaymentRequest>( |
| 85 base::MakeUnique<web::PaymentRequest>(web_payment_request), | 89 base::MakeUnique<web::PaymentRequest>(web_payment_request), |
| 86 personal_data_manager.get()); | 90 personal_data_manager.get()); |
| 87 } | 91 } |
| 88 | 92 |
| 89 } // namespace payment_request_test_util | 93 } // namespace payment_request_test_util |
| OLD | NEW |