Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(910)

Unified Diff: third_party/WebKit/Source/modules/payments/PaymentsValidatorsTest.cpp

Issue 2039863002: PaymentRequest: Sync up PaymentAddress with the payment request spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/payments/PaymentsValidatorsTest.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentsValidatorsTest.cpp b/third_party/WebKit/Source/modules/payments/PaymentsValidatorsTest.cpp
index a9a8b53eee60780b2b4e5af16d63afa2250e744e..bf5b9826371a1810b3bb7fa47edc8323ebb3aae3 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentsValidatorsTest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentsValidatorsTest.cpp
@@ -97,20 +97,20 @@ INSTANTIATE_TEST_CASE_P(Amounts,
class PaymentsRegionValidatorTest : public testing::TestWithParam<TestCase> {
};
-TEST_P(PaymentsRegionValidatorTest, IsValidRegionCodeFormat)
+TEST_P(PaymentsRegionValidatorTest, IsValidCountryCodeFormat)
{
String errorMessage;
- EXPECT_EQ(GetParam().expectedValid, PaymentsValidators::isValidRegionCodeFormat(GetParam().input, &errorMessage)) << errorMessage;
+ EXPECT_EQ(GetParam().expectedValid, PaymentsValidators::isValidCountryCodeFormat(GetParam().input, &errorMessage)) << errorMessage;
EXPECT_EQ(GetParam().expectedValid, errorMessage.isEmpty()) << errorMessage;
- EXPECT_EQ(GetParam().expectedValid, PaymentsValidators::isValidRegionCodeFormat(GetParam().input, nullptr));
+ EXPECT_EQ(GetParam().expectedValid, PaymentsValidators::isValidCountryCodeFormat(GetParam().input, nullptr));
}
-INSTANTIATE_TEST_CASE_P(RegionCodes,
+INSTANTIATE_TEST_CASE_P(CountryCodes,
PaymentsRegionValidatorTest,
testing::Values(
TestCase("US", true),
- // Invalid region code formats
+ // Invalid country code formats
TestCase("U1", false),
TestCase("U", false),
TestCase("us", false),
@@ -168,8 +168,8 @@ INSTANTIATE_TEST_CASE_P(ScriptCodes,
TestCase("LATN", false)));
struct ShippingAddressTestCase {
- ShippingAddressTestCase(const char* regionCode, const char* languageCode, const char* scriptCode, bool expectedValid)
- : regionCode(regionCode)
+ ShippingAddressTestCase(const char* countryCode, const char* languageCode, const char* scriptCode, bool expectedValid)
+ : countryCode(countryCode)
, languageCode(languageCode)
, scriptCode(scriptCode)
, expectedValid(expectedValid)
@@ -177,7 +177,7 @@ struct ShippingAddressTestCase {
}
~ShippingAddressTestCase() {}
- const char* regionCode;
+ const char* countryCode;
const char* languageCode;
const char* scriptCode;
bool expectedValid;
@@ -189,7 +189,7 @@ class PaymentsShippingAddressValidatorTest : public testing::TestWithParam<Shipp
TEST_P(PaymentsShippingAddressValidatorTest, IsValidShippingAddress)
{
mojom::blink::PaymentAddressPtr address = mojom::blink::PaymentAddress::New();
- address->region_code = GetParam().regionCode;
+ address->country = GetParam().countryCode;
address->language_code = GetParam().languageCode;
address->script_code = GetParam().scriptCode;
@@ -208,7 +208,7 @@ INSTANTIATE_TEST_CASE_P(ShippingAddresses,
ShippingAddressTestCase("US", "", "", true),
// Invalid shipping addresses
ShippingAddressTestCase("", "", "", false),
- ShippingAddressTestCase("InvalidRegionCode", "", "", false),
+ ShippingAddressTestCase("InvalidCountryCode", "", "", false),
ShippingAddressTestCase("US", "InvalidLanguageCode", "", false),
ShippingAddressTestCase("US", "en", "InvalidScriptCode", false),
ShippingAddressTestCase("US", "", "Latn", false)));

Powered by Google App Engine
This is Rietveld 408576698