Chromium Code Reviews| Index: chrome/android/junit/src/org/chromium/chrome/browser/payments/CurrencyStringFormatterTest.java |
| diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/payments/CurrencyStringFormatterTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/payments/CurrencyStringFormatterTest.java |
| index e84048e8c4e922e6b1659566794358a6698e9ca2..4dd0bcacf7711e7b4ec5e76733baa9bc9124d479 100644 |
| --- a/chrome/android/junit/src/org/chromium/chrome/browser/payments/CurrencyStringFormatterTest.java |
| +++ b/chrome/android/junit/src/org/chromium/chrome/browser/payments/CurrencyStringFormatterTest.java |
| @@ -74,13 +74,14 @@ public class CurrencyStringFormatterTest { |
| "$123,456,789,012,345,678,901,234,567,890.123456789012345678901234567890", |
| ExpectedValidity.VALID_AMOUNT}, |
| + // Any string can be valid amount currency codes. |
| + {"55.00", "", "en-US", "55.00", ExpectedValidity.VALID_AMOUNT}, |
| + {"55.00", "ABCDEF", "en-US", "55.00", ExpectedValidity.VALID_AMOUNT}, |
| + {"55.00", longString2048(), "en-US", "55.00", ExpectedValidity.VALID_AMOUNT}, |
| + |
| // Invalid amount currency codes. |
| - {"55.00", "", "en-US", null, ExpectedValidity.INVALID_AMOUNT_CURRENCY_CODE}, |
| - {"55.00", "usd", "en-US", null, ExpectedValidity.INVALID_AMOUNT_CURRENCY_CODE}, |
| - {"55.00", "US8", "en-US", null, ExpectedValidity.INVALID_AMOUNT_CURRENCY_CODE}, |
| - {"55.00", "US", "en-US", null, ExpectedValidity.INVALID_AMOUNT_CURRENCY_CODE}, |
| - {"55.00", "USDR", "en-US", null, ExpectedValidity.INVALID_AMOUNT_CURRENCY_CODE}, |
| - {"55.00", "USDr", "en-US", null, ExpectedValidity.INVALID_AMOUNT_CURRENCY_CODE}, |
| + {"55.00", longString2049(), "en-US", null, |
| + ExpectedValidity.INVALID_AMOUNT_CURRENCY_CODE}, |
| // Invalid amount values. |
| {"", "USD", "en-US", null, ExpectedValidity.INVALID_AMOUNT_VALUE}, |
| @@ -102,6 +103,23 @@ public class CurrencyStringFormatterTest { |
| private final String mExpectedFormatting; |
| private final ExpectedValidity mExpectedValidity; |
| + private static String longString2048() { |
|
please use gerrit instead
2016/08/29 14:23:40
This creates 2049 objects. Use https://docs.oracle
pals
2016/08/30 09:02:09
Done.
|
| + String currency = ""; |
| + for (int i = 0; i < 2048; i++) { |
| + currency = currency + "A"; |
| + } |
| + return currency; |
| + } |
| + |
| + private static String longString2049() { |
|
please use gerrit instead
2016/08/29 14:23:40
Ditto.
pals
2016/08/30 09:02:09
Done.
|
| + String currency = ""; |
| + for (int i = 0; i < 2049; i++) { |
| + currency = currency + "A"; |
| + } |
| + return currency; |
| + } |
| + |
| + |
| public CurrencyStringFormatterTest(String amount, String currency, String languageTag, |
| String expectedFormatting, ExpectedValidity expectedValidity) { |
| mAmount = amount; |