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

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

Issue 2101463002: PaymentRequest: Implement PaymentDetailsModifier dictionary (in blink side). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments 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/PaymentRequestDetailsTest.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp
index 260ca91cd043aa7ddad9eaf1261e4c3a973b10d6..69b18f4c9a67c4a0250bf5f836795337463e7e08 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp
@@ -73,6 +73,12 @@ std::ostream& operator<<(std::ostream& out, DetailsTestCase testCase)
case PaymentTestDetailShippingOption:
out << "shippingOption ";
break;
+ case PaymentTestDetailModifierTotal:
+ out << "modifiers.total ";
+ break;
+ case PaymentTestDetailModifierItem:
+ out << "modifiers.displayItem ";
+ break;
case PaymentTestDetailNone:
NOTREACHED();
break;
@@ -140,7 +146,15 @@ INSTANTIATE_TEST_CASE_P(MissingData,
DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataValue, PaymentTestRemoveKey, "", true, V8TypeError),
DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataCurrencyCode, PaymentTestRemoveKey, "", true, V8TypeError),
DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataId, PaymentTestRemoveKey, "", true, V8TypeError),
- DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataLabel, PaymentTestRemoveKey, "", true, V8TypeError)));
+ DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataLabel, PaymentTestRemoveKey, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataAmount, PaymentTestRemoveKey, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestRemoveKey, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataCurrencyCode, PaymentTestRemoveKey, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataLabel, PaymentTestRemoveKey, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataAmount, PaymentTestRemoveKey, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestRemoveKey, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataCurrencyCode, PaymentTestRemoveKey, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataLabel, PaymentTestRemoveKey, "", true, V8TypeError)));
INSTANTIATE_TEST_CASE_P(EmptyData,
PaymentRequestDetailsTest,
@@ -154,14 +168,22 @@ INSTANTIATE_TEST_CASE_P(EmptyData,
DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataValue, PaymentTestOverwriteValue, "", true, V8TypeError),
DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "", true, V8TypeError),
DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataId, PaymentTestOverwriteValue, "", true, V8TypeError),
- DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataLabel, PaymentTestOverwriteValue, "", true, V8TypeError)));
+ DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataLabel, PaymentTestOverwriteValue, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataLabel, PaymentTestOverwriteValue, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataLabel, PaymentTestOverwriteValue, "", true, V8TypeError)));
INSTANTIATE_TEST_CASE_P(ValidCurrencyCodeFormat,
PaymentRequestDetailsTest,
testing::Values(
DetailsTestCase(PaymentTestDetailTotal, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "USD"),
DetailsTestCase(PaymentTestDetailItem, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "USD"),
- DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "USD")));
+ DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "USD"),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "USD"),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "USD")));
INSTANTIATE_TEST_CASE_P(InvalidCurrencyCodeFormat,
PaymentRequestDetailsTest,
@@ -180,7 +202,17 @@ INSTANTIATE_TEST_CASE_P(InvalidCurrencyCodeFormat,
DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "US", true, V8TypeError),
DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "USDO", true, V8TypeError),
DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "usd", true, V8TypeError),
- DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "", true, V8TypeError)));
+ DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "US1", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "US", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "USDO", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "usd", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "US1", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "US", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "USDO", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "usd", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataCurrencyCode, PaymentTestOverwriteValue, "", true, V8TypeError)));
INSTANTIATE_TEST_CASE_P(ValidValueFormat,
PaymentRequestDetailsTest,
@@ -219,6 +251,30 @@ INSTANTIATE_TEST_CASE_P(ValidValueFormat,
DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataValue, PaymentTestOverwriteValue, "-01234567890123456789012345678.9"),
DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataValue, PaymentTestOverwriteValue, "-012345678901234567890123456789")));
+INSTANTIATE_TEST_CASE_P(ValidValueFormatForModifier,
+ PaymentRequestDetailsTest,
+ testing::Values(
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "0"),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "1"),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "10"),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "10.99"),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "01234567890123456789.0123456789"),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "01234567890123456789012345678.9"),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "012345678901234567890123456789"),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "0"),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "-0"),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "1"),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "10"),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "-3"),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "10.99"),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "-3.00"),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "01234567890123456789.0123456789"),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "01234567890123456789012345678.9"),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "012345678901234567890123456789"),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "-01234567890123456789.0123456789"),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "-01234567890123456789012345678.9"),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "-012345678901234567890123456789")));
+
INSTANTIATE_TEST_CASE_P(InvalidValueFormat,
PaymentRequestDetailsTest,
testing::Values(
@@ -262,5 +318,37 @@ INSTANTIATE_TEST_CASE_P(InvalidValueFormat,
DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataValue, PaymentTestOverwriteValue, "1.0.0", true, V8TypeError),
DetailsTestCase(PaymentTestDetailShippingOption, PaymentTestDataValue, PaymentTestOverwriteValue, "1/3", true, V8TypeError)));
+INSTANTIATE_TEST_CASE_P(InvalidValueFormatForModifier,
+ PaymentRequestDetailsTest,
+ testing::Values(
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "-0", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "-3", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "-3.00", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "-", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "notdigits", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "ALSONOTDIGITS", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "10.", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, ".99", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "-10.", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "10-", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "1-0", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "1.0.0", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "1/3", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "-01234567890123456789.0123456789", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "-01234567890123456789012345678.9", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierTotal, PaymentTestDataValue, PaymentTestOverwriteValue, "-012345678901234567890123456789", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "-", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "notdigits", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "ALSONOTDIGITS", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "10.", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, ".99", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "-10.", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "10-", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "1-0", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "1.0.0", true, V8TypeError),
+ DetailsTestCase(PaymentTestDetailModifierItem, PaymentTestDataValue, PaymentTestOverwriteValue, "1/3", true, V8TypeError)));
+
} // namespace
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698