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

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: Use "git cl format". 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 } 143 }
144 144
145 TEST(PhoneNumberI18NTest, ConstructPhoneNumber) { 145 TEST(PhoneNumberI18NTest, ConstructPhoneNumber) {
146 base::string16 number; 146 base::string16 number;
147 EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16("1"), 147 EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16("1"),
148 ASCIIToUTF16("650"), 148 ASCIIToUTF16("650"),
149 ASCIIToUTF16("2345678"), 149 ASCIIToUTF16("2345678"),
150 "US", 150 "US",
151 &number)); 151 &number));
152 EXPECT_EQ(number, ASCIIToUTF16("+1 650-234-5678")); 152 EXPECT_EQ(number, ASCIIToUTF16("1 650-234-5678"));
Evan Stade 2014/07/17 00:54:48 these expectations are backwards (expected value g
153 EXPECT_TRUE(ConstructPhoneNumber(base::string16(), 153 EXPECT_TRUE(ConstructPhoneNumber(base::string16(),
154 ASCIIToUTF16("650"), 154 ASCIIToUTF16("650"),
155 ASCIIToUTF16("2345678"), 155 ASCIIToUTF16("2345678"),
156 "US", 156 "US",
157 &number)); 157 &number));
158 EXPECT_EQ(number, ASCIIToUTF16("(650) 234-5678")); 158 EXPECT_EQ(number, ASCIIToUTF16("(650) 234-5678"));
159 EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16("1"), 159 EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16("1"),
160 base::string16(), 160 base::string16(),
161 ASCIIToUTF16("6502345678"), 161 ASCIIToUTF16("6502345678"),
162 "US", 162 "US",
163 &number)); 163 &number));
164 EXPECT_EQ(number, ASCIIToUTF16("+1 650-234-5678")); 164 EXPECT_EQ(number, ASCIIToUTF16("1 650-234-5678"));
165 EXPECT_TRUE(ConstructPhoneNumber(base::string16(), 165 EXPECT_TRUE(ConstructPhoneNumber(base::string16(),
166 base::string16(), 166 base::string16(),
167 ASCIIToUTF16("6502345678"), 167 ASCIIToUTF16("6502345678"),
168 "US", 168 "US",
169 &number)); 169 &number));
170 EXPECT_EQ(number, ASCIIToUTF16("(650) 234-5678")); 170 EXPECT_EQ(number, ASCIIToUTF16("(650) 234-5678"));
171 171
172 EXPECT_FALSE(ConstructPhoneNumber(base::string16(), 172 EXPECT_FALSE(ConstructPhoneNumber(base::string16(),
173 ASCIIToUTF16("650"), 173 ASCIIToUTF16("650"),
174 ASCIIToUTF16("234567890"), 174 ASCIIToUTF16("234567890"),
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 "en-US")); 250 "en-US"));
251 251
252 // Different numbers don't match. 252 // Different numbers don't match.
253 EXPECT_FALSE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"), 253 EXPECT_FALSE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"),
254 ASCIIToUTF16("1415888"), 254 ASCIIToUTF16("1415888"),
255 "US", 255 "US",
256 "en-US")); 256 "en-US"));
257 } 257 }
258 258
259 } // namespace autofill 259 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698