| 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.h" | 5 #include "ios/chrome/browser/payments/payment_request.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "components/autofill/core/browser/test_personal_data_manager.h" | 8 #include "components/autofill/core/browser/test_personal_data_manager.h" |
| 9 #include "components/payments/currency_formatter.h" | 9 #include "components/payments/core/currency_formatter.h" |
| 10 #include "ios/chrome/browser/application_context.h" | 10 #include "ios/chrome/browser/application_context.h" |
| 11 #include "ios/web/public/payments/payment_request.h" | 11 #include "ios/web/public/payments/payment_request.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 #if !defined(__has_feature) || !__has_feature(objc_arc) | 14 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 15 #error "This file requires ARC support." | 15 #error "This file requires ARC support." |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 // Tests that the payments::CurrencyFormatter is constructed with the correct | 18 // Tests that the payments::CurrencyFormatter is constructed with the correct |
| 19 // currency code and currency system. | 19 // currency code and currency system. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 46 web_payment_request->details.total.amount.currency_system = | 46 web_payment_request->details.total.amount.currency_system = |
| 47 base::ASCIIToUTF16("NOT_ISO4217"); | 47 base::ASCIIToUTF16("NOT_ISO4217"); |
| 48 web_payment_request->details.total.amount.currency = | 48 web_payment_request->details.total.amount.currency = |
| 49 base::ASCIIToUTF16("USD"); | 49 base::ASCIIToUTF16("USD"); |
| 50 PaymentRequest payment_request3(std::move(web_payment_request), | 50 PaymentRequest payment_request3(std::move(web_payment_request), |
| 51 &personal_data_manager); | 51 &personal_data_manager); |
| 52 currency_formatter = payment_request3.GetOrCreateCurrencyFormatter(); | 52 currency_formatter = payment_request3.GetOrCreateCurrencyFormatter(); |
| 53 ASSERT_EQ(base::UTF8ToUTF16("55.00"), currency_formatter->Format("55.00")); | 53 ASSERT_EQ(base::UTF8ToUTF16("55.00"), currency_formatter->Format("55.00")); |
| 54 ASSERT_EQ("USD", currency_formatter->formatted_currency_code()); | 54 ASSERT_EQ("USD", currency_formatter->formatted_currency_code()); |
| 55 } | 55 } |
| OLD | NEW |