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

Unified Diff: components/payments/content/payment_response_helper_unittest.cc

Issue 2810293002: [Payments] Format contact detail phone desktop (Closed)
Patch Set: Addressed comments 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/content/payment_response_helper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/payments/content/payment_response_helper_unittest.cc
diff --git a/components/payments/content/payment_response_helper_unittest.cc b/components/payments/content/payment_response_helper_unittest.cc
index d072121cf21dbc64b14569f45419cea02875cb42..3b56de9925586855b0cc914c8254b70b2c3b2557 100644
--- a/components/payments/content/payment_response_helper_unittest.cc
+++ b/components/payments/content/payment_response_helper_unittest.cc
@@ -245,7 +245,7 @@ TEST_F(PaymentResponseHelperTest, GeneratePaymentResponse_ContactDetails_All) {
// Check that all the expected values were set.
EXPECT_EQ("John H. Doe", response()->payer_name.value());
- EXPECT_EQ("16502111111", response()->payer_phone.value());
+ EXPECT_EQ("+16502111111", response()->payer_phone.value());
EXPECT_EQ("johndoe@hades.com", response()->payer_email.value());
}
@@ -266,4 +266,22 @@ TEST_F(PaymentResponseHelperTest, GeneratePaymentResponse_ContactDetails_Some) {
EXPECT_FALSE(response()->payer_email.has_value());
}
+// Tests the the generated PaymentResponse has the correct values for the
+// contact details when all values are requested.
+TEST_F(PaymentResponseHelperTest,
+ GeneratePaymentResponse_ContactPhoneIsFormatted) {
+ // Request one contact detail value.
+ mojom::PaymentOptionsPtr options = mojom::PaymentOptions::New();
+ options->request_payer_phone = true;
+ test_address()->SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER,
+ base::UTF8ToUTF16("(515) 123-1234"));
+ RecreateSpecWithOptions(std::move(options));
+
+ PaymentResponseHelper helper("en-US", spec(), test_instrument(),
+ test_address(), test_address(), this);
+
+ // Check that the phone was formatted.
+ EXPECT_EQ("+15151231234", response()->payer_phone.value());
+}
+
} // namespace payments
« no previous file with comments | « components/payments/content/payment_response_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698