| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/utf_string_conversions.h" | |
| 6 #include "chrome/browser/autofill/phone_number_i18n.h" | |
| 7 #include "testing/gtest/include/gtest/gtest.h" | |
| 8 | |
| 9 using namespace autofill_i18n; | |
| 10 | |
| 11 TEST(PhoneNumberI18NTest, PhoneNumbersMatch) { | |
| 12 // Same numbers, defined country code. | |
| 13 EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("4158889999"), | |
| 14 ASCIIToUTF16("4158889999"), | |
| 15 "US")); | |
| 16 // Same numbers, undefined country code. | |
| 17 EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("4158889999"), | |
| 18 ASCIIToUTF16("4158889999"), | |
| 19 "")); | |
| 20 | |
| 21 // Numbers differ by country code only. | |
| 22 EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"), | |
| 23 ASCIIToUTF16("4158889999"), | |
| 24 "US")); | |
| 25 | |
| 26 // Same numbers, different formats. | |
| 27 EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("4158889999"), | |
| 28 ASCIIToUTF16("415-888-9999"), | |
| 29 "US")); | |
| 30 EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("4158889999"), | |
| 31 ASCIIToUTF16("(415)888-9999"), | |
| 32 "US")); | |
| 33 EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("4158889999"), | |
| 34 ASCIIToUTF16("415 888 9999"), | |
| 35 "US")); | |
| 36 EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("4158889999"), | |
| 37 ASCIIToUTF16("415 TUV WXYZ"), | |
| 38 "US")); | |
| 39 | |
| 40 // Partial matches don't count. | |
| 41 EXPECT_FALSE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"), | |
| 42 ASCIIToUTF16("8889999"), | |
| 43 "US")); | |
| 44 } | |
| OLD | NEW |