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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « components/payments/core/payment_request_data_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/payments/core/payment_request_data_util.h" 5 #include "components/payments/core/payment_request_data_util.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 "\"recipient\":\"John H. Doe\"," 65 "\"recipient\":\"John H. Doe\","
66 "\"region\":\"CA\"}," 66 "\"region\":\"CA\"},"
67 "\"cardNumber\":\"4111111111111111\"," 67 "\"cardNumber\":\"4111111111111111\","
68 "\"cardSecurityCode\":\"123\"," 68 "\"cardSecurityCode\":\"123\","
69 "\"cardholderName\":\"Test User\"," 69 "\"cardholderName\":\"Test User\","
70 "\"expiryMonth\":\"11\"," 70 "\"expiryMonth\":\"11\","
71 "\"expiryYear\":\"2022\"}", 71 "\"expiryYear\":\"2022\"}",
72 json_response); 72 json_response);
73 } 73 }
74 74
75 // Tests that the phone numbers are correctly formatted for the Payment
76 // Response.
77 TEST(PaymentRequestDataUtilTest, FormatPhoneForResponse) {
78 EXPECT_EQ("+15151231234", payments::data_util::FormatPhoneForResponse(
79 "(515) 123-1234", "US"));
80 EXPECT_EQ("+15151231234", payments::data_util::FormatPhoneForResponse(
81 "(1) 515-123-1234", "US"));
82 EXPECT_EQ("+33142685300",
83 payments::data_util::FormatPhoneForResponse("1 42 68 53 00", "FR"));
84 }
85
86 // Tests that the phone numbers are correctly formatted to display to the user.
87 TEST(PaymentRequestDataUtilTest, FormatPhoneForDisplay) {
88 EXPECT_EQ("+1 515-123-1234",
89 payments::data_util::FormatPhoneForDisplay("5151231234", "US"));
90 EXPECT_EQ("+33 1 42 68 53 00",
91 payments::data_util::FormatPhoneForDisplay("142685300", "FR"));
92 }
93
75 } // namespace data_util 94 } // namespace data_util
76 } // namespace payments 95 } // namespace payments
OLDNEW
« 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