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 "components/payments/currency_formatter.h" | 5 #include "components/payments/currency_formatter.h" |
6 | 6 |
7 #include "base/optional.h" | 7 #include "base/optional.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 expected_amount(expected_amount), | 25 expected_amount(expected_amount), |
26 expected_currency_code(expected_currency_code), | 26 expected_currency_code(expected_currency_code), |
27 currency_system(currency_system) {} | 27 currency_system(currency_system) {} |
28 ~TestCase() {} | 28 ~TestCase() {} |
29 | 29 |
30 const char* const amount; | 30 const char* const amount; |
31 const char* const currency_code; | 31 const char* const currency_code; |
32 const char* const locale_name; | 32 const char* const locale_name; |
33 const std::string expected_amount; | 33 const std::string expected_amount; |
34 const char* const expected_currency_code; | 34 const char* const expected_currency_code; |
35 const base::Optional<std::string> currency_system; | 35 const char* const currency_system; |
36 }; | 36 }; |
37 | 37 |
38 class PaymentsCurrencyFormatterTest : public testing::TestWithParam<TestCase> { | 38 class PaymentsCurrencyFormatterTest : public testing::TestWithParam<TestCase> { |
39 }; | 39 }; |
40 | 40 |
41 TEST_P(PaymentsCurrencyFormatterTest, IsValidCurrencyFormat) { | 41 TEST_P(PaymentsCurrencyFormatterTest, IsValidCurrencyFormat) { |
42 CurrencyFormatter formatter(GetParam().currency_code, | 42 CurrencyFormatter formatter(GetParam().currency_code, |
43 GetParam().currency_system, | 43 GetParam().currency_system, |
44 GetParam().locale_name); | 44 GetParam().locale_name); |
45 base::string16 output_amount = formatter.Format(GetParam().amount); | 45 base::string16 output_amount = formatter.Format(GetParam().amount); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 "JPY", | 169 "JPY", |
170 "http://currsystem.com"), | 170 "http://currsystem.com"), |
171 TestCase("0.1234", | 171 TestCase("0.1234", |
172 "USD", | 172 "USD", |
173 "en_US", | 173 "en_US", |
174 "0.1234", | 174 "0.1234", |
175 "USD", | 175 "USD", |
176 "http://currsystem.com"))); | 176 "http://currsystem.com"))); |
177 | 177 |
178 } // namespace payments | 178 } // namespace payments |
OLD | NEW |