diff options
author | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-19 23:42:29 +0000 |
---|---|---|
committer | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-19 23:42:29 +0000 |
commit | 944a5cd8a1a814a9534f8254c46438036b9426c9 (patch) | |
tree | 79182955fd10469e88268e37c7b7bd27adbfcbf3 /chrome/browser/autofill/phone_number_i18n_unittest.cc | |
parent | 15fff4ca66b57004289d7a8f4de72a93526717b0 (diff) | |
download | chromium_src-944a5cd8a1a814a9534f8254c46438036b9426c9.zip chromium_src-944a5cd8a1a814a9534f8254c46438036b9426c9.tar.gz chromium_src-944a5cd8a1a814a9534f8254c46438036b9426c9.tar.bz2 |
Clean up phone_number_i18n code.
Remove a few unused functions, refactor a bit of code.
This is primarily in preparation for fixing http://crbug.com/100745
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/8347030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106414 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/phone_number_i18n_unittest.cc')
-rw-r--r-- | chrome/browser/autofill/phone_number_i18n_unittest.cc | 58 |
1 files changed, 8 insertions, 50 deletions
diff --git a/chrome/browser/autofill/phone_number_i18n_unittest.cc b/chrome/browser/autofill/phone_number_i18n_unittest.cc index 8798e5b..a2eb312 100644 --- a/chrome/browser/autofill/phone_number_i18n_unittest.cc +++ b/chrome/browser/autofill/phone_number_i18n_unittest.cc @@ -9,8 +9,6 @@ using autofill_i18n::NormalizePhoneNumber; using autofill_i18n::ParsePhoneNumber; using autofill_i18n::ConstructPhoneNumber; -using autofill_i18n::FormatPhone; -using autofill_i18n::ComparePhones; using autofill_i18n::PhoneNumbersMatch; typedef testing::Test PhoneNumberI18NTest; @@ -323,54 +321,6 @@ TEST_F(PhoneNumberI18NTest, ConstructPhoneNumber) { EXPECT_EQ(number, ASCIIToUTF16("+49 2423/45678901")); } -TEST_F(PhoneNumberI18NTest, FormatPhone) { - EXPECT_EQ(FormatPhone(ASCIIToUTF16("1[650]234-56-78"), "US", - autofill_i18n::NATIONAL), - ASCIIToUTF16("(650) 234-5678")); - EXPECT_EQ(FormatPhone(ASCIIToUTF16("(650)234-56-78"), "US", - autofill_i18n::NATIONAL), - ASCIIToUTF16("(650) 234-5678")); - EXPECT_EQ(FormatPhone(ASCIIToUTF16("(650)234-56-78"), "US", - autofill_i18n::INTERNATIONAL), - ASCIIToUTF16("+1 650-234-5678")); - EXPECT_EQ(FormatPhone(ASCIIToUTF16("01139236618300"), "US", - autofill_i18n::INTERNATIONAL), - ASCIIToUTF16("+39 236618300")); - EXPECT_EQ(FormatPhone(ASCIIToUTF16("1(650)234-56-78"), "CZ", - autofill_i18n::NATIONAL), - ASCIIToUTF16("16502345678")); - EXPECT_EQ(FormatPhone(ASCIIToUTF16("1(650)234-56-78"), "CZ", - autofill_i18n::INTERNATIONAL), - ASCIIToUTF16("+420 16502345678")); -} - -TEST_F(PhoneNumberI18NTest, ComparePhones) { - EXPECT_EQ(ComparePhones(ASCIIToUTF16("1(650)234-56-78"), - ASCIIToUTF16("+16502345678"), - "US"), - autofill_i18n::PHONES_EQUAL); - EXPECT_EQ(ComparePhones(ASCIIToUTF16("1(650)234-56-78"), - ASCIIToUTF16("6502345678"), - "US"), - autofill_i18n::PHONES_EQUAL); - EXPECT_EQ(ComparePhones(ASCIIToUTF16("1-800-FLOWERS"), - ASCIIToUTF16("18003569377"), - "US"), - autofill_i18n::PHONES_EQUAL); - EXPECT_EQ(ComparePhones(ASCIIToUTF16("1(650)234-56-78"), - ASCIIToUTF16("2345678"), - "US"), - autofill_i18n::PHONES_SUBMATCH); - EXPECT_EQ(ComparePhones(ASCIIToUTF16("234-56-78"), - ASCIIToUTF16("+16502345678"), - "US"), - autofill_i18n::PHONES_SUBMATCH); - EXPECT_EQ(ComparePhones(ASCIIToUTF16("1650234"), - ASCIIToUTF16("+16502345678"), - "US"), - autofill_i18n::PHONES_NOT_EQUAL); -} - TEST_F(PhoneNumberI18NTest, PhoneNumbersMatch) { // Same numbers, defined country code. EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("4158889999"), @@ -399,9 +349,17 @@ TEST_F(PhoneNumberI18NTest, PhoneNumbersMatch) { EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("4158889999"), ASCIIToUTF16("415 TUV WXYZ"), "US")); + EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("1(415)888-99-99"), + ASCIIToUTF16("+14158889999"), + "US")); // Partial matches don't count. EXPECT_FALSE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"), ASCIIToUTF16("8889999"), "US")); + + // Different numbers don't match. + EXPECT_FALSE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"), + ASCIIToUTF16("1415888"), + "US")); } |