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

Unified Diff: components/payments/core/payment_request_data_util_unittest.cc

Issue 2808983003: [Payments] Format shipping and billing phone number in normalizer. (Closed)
Patch Set: Nits Created 3 years, 8 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
« no previous file with comments | « components/payments/core/payment_request_data_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/payments/core/payment_request_data_util_unittest.cc
diff --git a/components/payments/core/payment_request_data_util_unittest.cc b/components/payments/core/payment_request_data_util_unittest.cc
index 34b80a70d40abfdc226599a0ab310b8ead2b35fa..5ad7e10963776fb3ff6128ec493b5aa54dece491 100644
--- a/components/payments/core/payment_request_data_util_unittest.cc
+++ b/components/payments/core/payment_request_data_util_unittest.cc
@@ -72,5 +72,24 @@ TEST(PaymentRequestDataUtilTest, GetBasicCardResponseFromAutofillCreditCard) {
json_response);
}
+// Tests that the phone numbers are correctly formatted for the Payment
+// Response.
+TEST(PaymentRequestDataUtilTest, FormatPhoneForResponse) {
+ EXPECT_EQ("+15151231234", payments::data_util::FormatPhoneForResponse(
+ "(515) 123-1234", "US"));
+ EXPECT_EQ("+15151231234", payments::data_util::FormatPhoneForResponse(
+ "(1) 515-123-1234", "US"));
+ EXPECT_EQ("+33142685300",
+ payments::data_util::FormatPhoneForResponse("1 42 68 53 00", "FR"));
+}
+
+// Tests that the phone numbers are correctly formatted to display to the user.
+TEST(PaymentRequestDataUtilTest, FormatPhoneForDisplay) {
+ EXPECT_EQ("+1 515-123-1234",
+ payments::data_util::FormatPhoneForDisplay("5151231234", "US"));
+ EXPECT_EQ("+33 1 42 68 53 00",
+ payments::data_util::FormatPhoneForDisplay("142685300", "FR"));
+}
+
} // namespace data_util
} // namespace payments
« no previous file with comments | « components/payments/core/payment_request_data_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698