summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/autofill/autofill_profile.cc2
-rw-r--r--chrome/browser/autofill/autofill_profile_unittest.cc9
-rw-r--r--chrome/browser/autofill/personal_data_manager_unittest.cc20
3 files changed, 20 insertions, 11 deletions
diff --git a/chrome/browser/autofill/autofill_profile.cc b/chrome/browser/autofill/autofill_profile.cc
index ff7356c..5783760 100644
--- a/chrome/browser/autofill/autofill_profile.cc
+++ b/chrome/browser/autofill/autofill_profile.cc
@@ -426,7 +426,7 @@ int AutofillProfile::Compare(const AutofillProfile& profile) const {
NAME_MIDDLE,
NAME_LAST,
EMAIL_ADDRESS,
- PHONE_HOME_NUMBER };
+ PHONE_HOME_WHOLE_NUMBER };
for (size_t i = 0; i < arraysize(multi_value_types); ++i) {
std::vector<string16> values_a;
diff --git a/chrome/browser/autofill/autofill_profile_unittest.cc b/chrome/browser/autofill/autofill_profile_unittest.cc
index 26f4de4..0fc822e 100644
--- a/chrome/browser/autofill/autofill_profile_unittest.cc
+++ b/chrome/browser/autofill/autofill_profile_unittest.cc
@@ -578,6 +578,15 @@ TEST(AutofillProfileTest, Compare) {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
EXPECT_GT(0, a.Compare(b));
EXPECT_LT(0, b.Compare(a));
+
+ // Phone numbers are compared by the full number, including the area code.
+ // This is a regression test for http://crbug.com/163024
+ autofill_test::SetProfileInfo(&a, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, "650.555.4321");
+ autofill_test::SetProfileInfo(&b, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, "408.555.4321");
+ EXPECT_GT(0, a.Compare(b));
+ EXPECT_LT(0, b.Compare(a));
}
TEST(AutofillProfileTest, CountryCode) {
diff --git a/chrome/browser/autofill/personal_data_manager_unittest.cc b/chrome/browser/autofill/personal_data_manager_unittest.cc
index 3a7e8b0..6f64256 100644
--- a/chrome/browser/autofill/personal_data_manager_unittest.cc
+++ b/chrome/browser/autofill/personal_data_manager_unittest.cc
@@ -647,7 +647,7 @@ TEST_F(PersonalDataManagerTest, ImportPhoneNumberSplitAcrossMultipleFields) {
AutofillProfile expected;
autofill_test::SetProfileInfo(&expected, "George", NULL,
"Washington", NULL, NULL, "21 Laussat St", NULL,
- "San Francisco", "California", "94102", NULL, "6505550000");
+ "San Francisco", "California", "94102", NULL, "(650) 555-0000");
const std::vector<AutofillProfile*>& results = personal_data_->profiles();
ASSERT_EQ(1U, results.size());
EXPECT_EQ(0, expected.Compare(*results[0]));
@@ -903,7 +903,6 @@ TEST_F(PersonalDataManagerTest, AggregateSameProfileWithConflict) {
autofill_test::CreateTestFormField(
"Email:", "email", "theprez@gmail.com", "text", &field);
form1.fields.push_back(field);
- // Phone gets updated.
autofill_test::CreateTestFormField(
"Phone:", "phone", "6505556666", "text", &field);
form1.fields.push_back(field);
@@ -921,9 +920,10 @@ TEST_F(PersonalDataManagerTest, AggregateSameProfileWithConflict) {
MessageLoop::current()->Run();
AutofillProfile expected;
- autofill_test::SetProfileInfo(&expected, "George", NULL,
- "Washington", "theprez@gmail.com", NULL, "1600 Pennsylvania Avenue",
- "Suite A", "San Francisco", "California", "94102", NULL, "4085556666");
+ autofill_test::SetProfileInfo(
+ &expected, "George", NULL, "Washington", "theprez@gmail.com", NULL,
+ "1600 Pennsylvania Avenue", "Suite A", "San Francisco", "California",
+ "94102", NULL, "(650) 555-6666");
const std::vector<AutofillProfile*>& results1 = personal_data_->profiles();
ASSERT_EQ(1U, results1.size());
EXPECT_EQ(0, expected.Compare(*results1[0]));
@@ -979,7 +979,7 @@ TEST_F(PersonalDataManagerTest, AggregateSameProfileWithConflict) {
// Add multi-valued phone number to expectation. Also, country gets added.
std::vector<string16> values;
expected.GetMultiInfo(PHONE_HOME_WHOLE_NUMBER, &values);
- values.push_back(ASCIIToUTF16("6502231234"));
+ values.push_back(ASCIIToUTF16("(650) 223-1234"));
expected.SetMultiInfo(PHONE_HOME_WHOLE_NUMBER, values);
expected.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("United States"));
ASSERT_EQ(1U, results2.size());
@@ -1918,7 +1918,7 @@ TEST_F(PersonalDataManagerTest, CaseInsensitiveMultiValueAggregation) {
AutofillProfile expected;
autofill_test::SetProfileInfo(&expected, "George", NULL,
"Washington", "theprez@gmail.com", NULL, "21 Laussat St", NULL,
- "San Francisco", "California", "94102", NULL, "817-555-6789");
+ "San Francisco", "California", "94102", NULL, "(817) 555-6789");
const std::vector<AutofillProfile*>& results1 = personal_data_->profiles();
ASSERT_EQ(1U, results1.size());
EXPECT_EQ(0, expected.Compare(*results1[0]));
@@ -1965,9 +1965,9 @@ TEST_F(PersonalDataManagerTest, CaseInsensitiveMultiValueAggregation) {
// Modify expected to include multi-valued fields.
std::vector<string16> values;
- expected.GetMultiInfo(PHONE_HOME_CITY_AND_NUMBER, &values);
- values.push_back(ASCIIToUTF16("214-555-1234"));
- expected.SetMultiInfo(PHONE_HOME_CITY_AND_NUMBER, values);
+ expected.GetMultiInfo(PHONE_HOME_WHOLE_NUMBER, &values);
+ values.push_back(ASCIIToUTF16("(214) 555-1234"));
+ expected.SetMultiInfo(PHONE_HOME_WHOLE_NUMBER, values);
ASSERT_EQ(1U, results2.size());
EXPECT_EQ(0, expected.Compare(*results2[0]));