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

Side by Side Diff: components/autofill/core/browser/phone_number_i18n_unittest.cc

Issue 355823007: Adjust autofill phone number format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add OWNERS for components/test/data/autofill directory. Created 6 years, 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "base/strings/string16.h" 6 #include "base/strings/string16.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "components/autofill/core/browser/phone_number_i18n.h" 8 #include "components/autofill/core/browser/phone_number_i18n.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/libphonenumber/src/phonenumber_api.h" 10 #include "third_party/libphonenumber/src/phonenumber_api.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 133 }
134 } 134 }
135 135
136 TEST(PhoneNumberI18NTest, ConstructPhoneNumber) { 136 TEST(PhoneNumberI18NTest, ConstructPhoneNumber) {
137 base::string16 number; 137 base::string16 number;
138 EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16("1"), 138 EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16("1"),
139 ASCIIToUTF16("650"), 139 ASCIIToUTF16("650"),
140 ASCIIToUTF16("2345678"), 140 ASCIIToUTF16("2345678"),
141 "US", 141 "US",
142 &number)); 142 &number));
143 EXPECT_EQ(number, ASCIIToUTF16("+1 650-234-5678")); 143 EXPECT_EQ(number, ASCIIToUTF16("1 650-234-5678"));
144 EXPECT_TRUE(ConstructPhoneNumber(base::string16(), 144 EXPECT_TRUE(ConstructPhoneNumber(base::string16(),
145 ASCIIToUTF16("650"), 145 ASCIIToUTF16("650"),
146 ASCIIToUTF16("2345678"), 146 ASCIIToUTF16("2345678"),
147 "US", 147 "US",
148 &number)); 148 &number));
149 EXPECT_EQ(number, ASCIIToUTF16("(650) 234-5678")); 149 EXPECT_EQ(number, ASCIIToUTF16("(650) 234-5678"));
150 EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16("1"), 150 EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16("1"),
151 base::string16(), 151 base::string16(),
152 ASCIIToUTF16("6502345678"), 152 ASCIIToUTF16("6502345678"),
153 "US", 153 "US",
154 &number)); 154 &number));
155 EXPECT_EQ(number, ASCIIToUTF16("+1 650-234-5678")); 155 EXPECT_EQ(number, ASCIIToUTF16("1 650-234-5678"));
156 EXPECT_TRUE(ConstructPhoneNumber(base::string16(), 156 EXPECT_TRUE(ConstructPhoneNumber(base::string16(),
157 base::string16(), 157 base::string16(),
158 ASCIIToUTF16("6502345678"), 158 ASCIIToUTF16("6502345678"),
159 "US", 159 "US",
160 &number)); 160 &number));
161 EXPECT_EQ(number, ASCIIToUTF16("(650) 234-5678")); 161 EXPECT_EQ(number, ASCIIToUTF16("(650) 234-5678"));
162 162
163 EXPECT_FALSE(ConstructPhoneNumber(base::string16(), 163 EXPECT_FALSE(ConstructPhoneNumber(base::string16(),
164 ASCIIToUTF16("650"), 164 ASCIIToUTF16("650"),
165 ASCIIToUTF16("234567890"), 165 ASCIIToUTF16("234567890"),
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 "en-US")); 241 "en-US"));
242 242
243 // Different numbers don't match. 243 // Different numbers don't match.
244 EXPECT_FALSE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"), 244 EXPECT_FALSE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"),
245 ASCIIToUTF16("1415888"), 245 ASCIIToUTF16("1415888"),
246 "US", 246 "US",
247 "en-US")); 247 "en-US"));
248 } 248 }
249 249
250 } // namespace autofill 250 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698