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

Side by Side Diff: chrome/browser/autofill/phone_number_i18n_unittest.cc

Issue 8687002: Cleanup: Convert ASCIIToUTF16("") to string16(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 5 #include "base/message_loop.h"
6 #include "base/string16.h"
6 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/autofill/phone_number_i18n.h" 8 #include "chrome/browser/autofill/phone_number_i18n.h"
8 #include "content/test/test_browser_thread.h" 9 #include "content/test/test_browser_thread.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 11
11 using autofill_i18n::NormalizePhoneNumber; 12 using autofill_i18n::NormalizePhoneNumber;
12 using autofill_i18n::ParsePhoneNumber; 13 using autofill_i18n::ParsePhoneNumber;
13 using autofill_i18n::ConstructPhoneNumber; 14 using autofill_i18n::ConstructPhoneNumber;
14 using autofill_i18n::PhoneNumbersMatch; 15 using autofill_i18n::PhoneNumbersMatch;
15 using content::BrowserThread; 16 using content::BrowserThread;
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 autofill_i18n::NATIONAL, 281 autofill_i18n::NATIONAL,
281 &number)); 282 &number));
282 EXPECT_EQ(number, ASCIIToUTF16("(650) 234-5678")); 283 EXPECT_EQ(number, ASCIIToUTF16("(650) 234-5678"));
283 EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16("1"), 284 EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16("1"),
284 ASCIIToUTF16("650"), 285 ASCIIToUTF16("650"),
285 ASCIIToUTF16("2345678"), 286 ASCIIToUTF16("2345678"),
286 "US", 287 "US",
287 autofill_i18n::RFC3966, 288 autofill_i18n::RFC3966,
288 &number)); 289 &number));
289 EXPECT_EQ(number, ASCIIToUTF16("+1-650-234-5678")); 290 EXPECT_EQ(number, ASCIIToUTF16("+1-650-234-5678"));
290 EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16(""), 291 EXPECT_TRUE(ConstructPhoneNumber(string16(),
291 ASCIIToUTF16("650"), 292 ASCIIToUTF16("650"),
292 ASCIIToUTF16("2345678"), 293 ASCIIToUTF16("2345678"),
293 "US", 294 "US",
294 autofill_i18n::INTERNATIONAL, 295 autofill_i18n::INTERNATIONAL,
295 &number)); 296 &number));
296 EXPECT_EQ(number, ASCIIToUTF16("+1 650-234-5678")); 297 EXPECT_EQ(number, ASCIIToUTF16("+1 650-234-5678"));
297 EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16(""), 298 EXPECT_TRUE(ConstructPhoneNumber(string16(),
298 ASCIIToUTF16(""), 299 string16(),
299 ASCIIToUTF16("6502345678"), 300 ASCIIToUTF16("6502345678"),
300 "US", 301 "US",
301 autofill_i18n::INTERNATIONAL, 302 autofill_i18n::INTERNATIONAL,
302 &number)); 303 &number));
303 EXPECT_EQ(number, ASCIIToUTF16("+1 650-234-5678")); 304 EXPECT_EQ(number, ASCIIToUTF16("+1 650-234-5678"));
304 305
305 EXPECT_FALSE(ConstructPhoneNumber(ASCIIToUTF16(""), 306 EXPECT_FALSE(ConstructPhoneNumber(string16(),
306 ASCIIToUTF16("650"), 307 ASCIIToUTF16("650"),
307 ASCIIToUTF16("234567890"), 308 ASCIIToUTF16("234567890"),
308 "US", 309 "US",
309 autofill_i18n::INTERNATIONAL, 310 autofill_i18n::INTERNATIONAL,
310 &number)); 311 &number));
311 EXPECT_EQ(number, string16()); 312 EXPECT_EQ(number, string16());
312 // Italian number 313 // Italian number
313 EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16(""), 314 EXPECT_TRUE(ConstructPhoneNumber(string16(),
314 ASCIIToUTF16("347"), 315 ASCIIToUTF16("347"),
315 ASCIIToUTF16("2345678"), 316 ASCIIToUTF16("2345678"),
316 "IT", 317 "IT",
317 autofill_i18n::INTERNATIONAL, 318 autofill_i18n::INTERNATIONAL,
318 &number)); 319 &number));
319 EXPECT_EQ(number, ASCIIToUTF16("+39 347 234 5678")); 320 EXPECT_EQ(number, ASCIIToUTF16("+39 347 234 5678"));
320 // German number. 321 // German number.
321 EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16("49"), 322 EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16("49"),
322 ASCIIToUTF16("024"), 323 ASCIIToUTF16("024"),
323 ASCIIToUTF16("2345678901"), 324 ASCIIToUTF16("2345678901"),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 // Partial matches don't count. 371 // Partial matches don't count.
371 EXPECT_FALSE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"), 372 EXPECT_FALSE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"),
372 ASCIIToUTF16("8889999"), 373 ASCIIToUTF16("8889999"),
373 "US")); 374 "US"));
374 375
375 // Different numbers don't match. 376 // Different numbers don't match.
376 EXPECT_FALSE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"), 377 EXPECT_FALSE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"),
377 ASCIIToUTF16("1415888"), 378 ASCIIToUTF16("1415888"),
378 "US")); 379 "US"));
379 } 380 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/form_field_unittest.cc ('k') | chrome/browser/autofill/phone_number_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698