diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-17 00:06:54 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-17 00:06:54 +0000 |
commit | 4ef55f8c1a419b2be13b2086e424d64abc6a11d2 (patch) | |
tree | cf0b2079a18b9945e7ee7512671fb75c95dd8467 /chrome/browser | |
parent | 82b23338f5f774258e11dd1e7e86c6216ffbfb18 (diff) | |
download | chromium_src-4ef55f8c1a419b2be13b2086e424d64abc6a11d2.zip chromium_src-4ef55f8c1a419b2be13b2086e424d64abc6a11d2.tar.gz chromium_src-4ef55f8c1a419b2be13b2086e424d64abc6a11d2.tar.bz2 |
Autofill: Remove fax number completely.
BUG=81846
TEST=*
R=isherman@chromium.org
Review URL: http://codereview.chromium.org/7892048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101602 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
51 files changed, 320 insertions, 1200 deletions
diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc index 7d45bb0..3f11458 100644 --- a/chrome/browser/autofill/autofill_browsertest.cc +++ b/chrome/browser/autofill/autofill_browsertest.cc @@ -77,8 +77,7 @@ class AutofillTest : public InProcessBrowserTest { autofill_test::SetProfileInfo( &profile, "Milton", "C.", "Waddams", "red.swingline@initech.com", "Initech", "4120 Freidrich Lane", - "Basement", "Austin", "Texas", "78744", "United States", "5125551234", - "5125550000"); + "Basement", "Austin", "Texas", "78744", "United States", "5125551234"); PersonalDataManager* personal_data_manager = browser()->profile()->GetPersonalDataManager(); diff --git a/chrome/browser/autofill/autofill_common_test.cc b/chrome/browser/autofill/autofill_common_test.cc index 25ae16f..b4c3ad7 100644 --- a/chrome/browser/autofill/autofill_common_test.cc +++ b/chrome/browser/autofill/autofill_common_test.cc @@ -37,7 +37,7 @@ void SetProfileInfo(AutofillProfile* profile, const char* last_name, const char* email, const char* company, const char* address1, const char* address2, const char* city, const char* state, const char* zipcode, const char* country, - const char* phone, const char* fax) { + const char* phone) { check_and_set(profile, NAME_FIRST, first_name); check_and_set(profile, NAME_MIDDLE, middle_name); check_and_set(profile, NAME_LAST, last_name); @@ -50,7 +50,6 @@ void SetProfileInfo(AutofillProfile* profile, check_and_set(profile, ADDRESS_HOME_ZIP, zipcode); check_and_set(profile, ADDRESS_HOME_COUNTRY, country); check_and_set(profile, PHONE_HOME_WHOLE_NUMBER, phone); - check_and_set(profile, PHONE_FAX_WHOLE_NUMBER, fax); } void SetProfileInfoWithGuid(AutofillProfile* profile, @@ -58,12 +57,12 @@ void SetProfileInfoWithGuid(AutofillProfile* profile, const char* last_name, const char* email, const char* company, const char* address1, const char* address2, const char* city, const char* state, const char* zipcode, const char* country, - const char* phone, const char* fax) { + const char* phone) { if (guid) profile->set_guid(guid); SetProfileInfo(profile, first_name, middle_name, last_name, email, company, address1, address2, city, state, zipcode, country, - phone, fax); + phone); } void SetCreditCardInfo(CreditCard* credit_card, diff --git a/chrome/browser/autofill/autofill_common_test.h b/chrome/browser/autofill/autofill_common_test.h index db42140..4b224b8 100644 --- a/chrome/browser/autofill/autofill_common_test.h +++ b/chrome/browser/autofill/autofill_common_test.h @@ -32,14 +32,14 @@ void SetProfileInfo(AutofillProfile* profile, const char* last_name, const char* email, const char* company, const char* address1, const char* address2, const char* city, const char* state, const char* zipcode, const char* country, - const char* phone, const char* fax); + const char* phone); void SetProfileInfoWithGuid(AutofillProfile* profile, const char* guid, const char* first_name, const char* middle_name, const char* last_name, const char* email, const char* company, const char* address1, const char* address2, const char* city, const char* state, const char* zipcode, const char* country, - const char* phone, const char* fax); + const char* phone); // A unit testing utility that is common to a number of the Autofill unit // tests. |SetCreditCardInfo| provides a quick way to populate a credit card diff --git a/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc b/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc index cec09d6..6667003 100644 --- a/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc +++ b/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc @@ -101,9 +101,6 @@ struct { { PHONE_HOME_NUMBER, L"phone_home_number" }, { PHONE_HOME_CITY_CODE, L"phone_home_city_code" }, { PHONE_HOME_COUNTRY_CODE, L"phone_home_country_code" }, - { PHONE_FAX_NUMBER, L"phone_fax_number" }, - { PHONE_FAX_CITY_CODE, L"phone_fax_city_code" }, - { PHONE_FAX_COUNTRY_CODE, L"phone_fax_country_code" }, { ADDRESS_HOME_LINE1, L"address_home_line1" }, { ADDRESS_HOME_LINE2, L"address_home_line2" }, { ADDRESS_HOME_CITY, L"address_home_city" }, @@ -136,8 +133,7 @@ bool ImportSingleProfile(FormGroup* profile, bool has_non_empty_fields = false; // Phones need to be rebuilt. - PhoneNumber::PhoneCombineHelper home(AutofillType::PHONE_HOME); - PhoneNumber::PhoneCombineHelper fax(AutofillType::PHONE_FAX); + PhoneNumber::PhoneCombineHelper phone; for (uint32 value_index = 0; value_index < key->ValueCount(); ++value_index) { std::wstring value_name; @@ -149,27 +145,21 @@ bool ImportSingleProfile(FormGroup* profile, string16 field_value = ReadAndDecryptValue(key, value_name.c_str()); if (!field_value.empty()) { has_non_empty_fields = true; - if (it->second == CREDIT_CARD_NUMBER) { + if (it->second == CREDIT_CARD_NUMBER) field_value = DecryptCCNumber(field_value); - } - // We need to store phone data in the variables, before building the whole - // number at the end. The rest of the fields are set "as is". - if (!home.SetInfo(it->second, field_value) && - !fax.SetInfo(it->second, field_value)) { + + // We need to store phone data in |phone| before building the whole number + // at the end. The rest of the fields are set "as is". + if (!phone.SetInfo(it->second, field_value)) profile->SetInfo(it->second, field_value); - } } } // Now re-construct the phones if needed. string16 constructed_number; - if (!home.IsEmpty() && - home.ParseNumber(std::string("US"), &constructed_number)) { + if (!phone.IsEmpty() && + phone.ParseNumber(std::string("US"), &constructed_number)) { profile->SetCanonicalizedInfo(PHONE_HOME_WHOLE_NUMBER, constructed_number); } - if (!fax.IsEmpty() && - fax.ParseNumber(std::string("US"), &constructed_number)) { - profile->SetCanonicalizedInfo(PHONE_FAX_WHOLE_NUMBER, constructed_number); - } return has_non_empty_fields; } diff --git a/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc b/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc index f98e52a..d4c1731 100644 --- a/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc +++ b/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc @@ -53,9 +53,6 @@ ValueDescription profile2[] = { { L"name_last", L"Doe" }, { L"email", L"janedoe@test.com" }, { L"company_name", L"Testcompany" }, - { L"phone_fax_number", L"555-6666" }, - { L"phone_fax_city_code", L"812" }, - { L"phone_fax_country_code", L"7" }, }; ValueDescription credit_card[] = { @@ -177,10 +174,6 @@ TEST_F(AutofillIeToolbarImportTest, TestAutofillImport) { EXPECT_EQ(profile2[1].value, profiles[0].GetInfo(NAME_LAST)); EXPECT_EQ(profile2[2].value, profiles[0].GetInfo(EMAIL_ADDRESS)); EXPECT_EQ(profile2[3].value, profiles[0].GetInfo(COMPANY_NAME)); - EXPECT_EQ(profile2[6].value, profiles[0].GetInfo(PHONE_FAX_COUNTRY_CODE)); - EXPECT_EQ(profile2[5].value, profiles[0].GetInfo(PHONE_FAX_CITY_CODE)); - EXPECT_EQ(L"5556666", profiles[0].GetInfo(PHONE_FAX_NUMBER)); - EXPECT_EQ(L"+7 812 555-66-66", profiles[0].GetInfo(PHONE_FAX_WHOLE_NUMBER)); ASSERT_EQ(1U, credit_cards.size()); EXPECT_EQ(credit_card[0].value, credit_cards[0].GetInfo(CREDIT_CARD_NAME)); diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index 1542d8b..79d379e 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -971,8 +971,7 @@ void AutofillManager::GetProfileSuggestions( // Phone numbers could be split in US forms, so field value could be // either prefix or suffix of the phone. bool matched_phones = false; - if ((type == PHONE_HOME_NUMBER || type == PHONE_FAX_NUMBER) && - !field_value_lower_case.empty() && + if (type == PHONE_HOME_NUMBER && !field_value_lower_case.empty() && (profile_value_lower_case.find(field_value_lower_case) != string16::npos)) { matched_phones = true; diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h index 21ded1c..f48de24 100644 --- a/chrome/browser/autofill/autofill_manager.h +++ b/chrome/browser/autofill/autofill_manager.h @@ -194,17 +194,17 @@ class AutofillManager : public TabContentsObserver, webkit_glue::FormField* field); // Set |field|'s value based on |cached_field|'s type and contents of the - // |profile|. The |variant| parameter specifies which value in a multi-valued + // |profile|. The |variant| parameter specifies which value in a multi-valued // profile. void FillFormField(const AutofillProfile& profile, const AutofillField& cached_field, size_t variant, webkit_glue::FormField* field); - // Set |field|'s value for phone/fax number based on contents of the - // |profile|. The |cached_field| specifies the type of the phone and whether - // this is a phone prefix or suffix. The |variant| parameter specifies which - // value in a multi-valued profile. + // Set |field|'s value for phone number based on contents of the |profile|. + // The |cached_field| specifies the type of the phone and whether this is a + // phone prefix or suffix. The |variant| parameter specifies which value in a + // multi-valued profile. void FillPhoneNumberField(const AutofillProfile& profile, const AutofillField& cached_field, size_t variant, @@ -223,8 +223,8 @@ class AutofillManager : public TabContentsObserver, void UpdateInitialInteractionTimestamp( const base::TimeTicks& interaction_timestamp); - // Send our current field type predictions to the renderer. - // This is a no-op if the appropriate command-line flag is not set. + // Send our current field type predictions to the renderer. This is a no-op if + // the appropriate command-line flag is not set. void SendAutofillTypePredictions( const std::vector<FormStructure*>& forms) const; diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc index 03a77df..1bfa258 100644 --- a/chrome/browser/autofill/autofill_manager_unittest.cc +++ b/chrome/browser/autofill/autofill_manager_unittest.cc @@ -104,20 +104,19 @@ class TestPersonalDataManager : public PersonalDataManager { "Presley", "theking@gmail.com", "RCA", "3734 Elvis Presley Blvd.", "Apt. 10", "Memphis", "Tennessee", "38116", "USA", - "12345678901", ""); + "12345678901"); profile->set_guid("00000000-0000-0000-0000-000000000001"); profiles->push_back(profile); profile = new AutofillProfile; autofill_test::SetProfileInfo(profile, "Charles", "Hardin", "Holley", "buddy@gmail.com", "Decca", "123 Apple St.", "unit 6", "Lubbock", - "Texas", "79401", "USA", "23456789012", - ""); + "Texas", "79401", "USA", "23456789012"); profile->set_guid("00000000-0000-0000-0000-000000000002"); profiles->push_back(profile); profile = new AutofillProfile; - autofill_test::SetProfileInfo(profile, "", "", "", "", "", "", "", - "", "", "", "", "", ""); + autofill_test::SetProfileInfo(profile, "", "", "", "", "", "", "", "", "", + "", "", ""); profile->set_guid("00000000-0000-0000-0000-000000000003"); profiles->push_back(profile); } @@ -188,9 +187,6 @@ void CreateTestAddressFormData(FormData* form) { "Phone Number", "phonenumber", "", "tel", &field); form->fields.push_back(field); autofill_test::CreateTestFormField( - "Fax", "fax", "", "text", &field); - form->fields.push_back(field); - autofill_test::CreateTestFormField( "Email", "email", "", "email", &field); form->fields.push_back(field); } @@ -287,7 +283,6 @@ void ExpectFilledForm(int page_id, const char* postal_code, const char* country, const char* phone, - const char* fax, const char* email, const char* name_on_card, const char* card_number, @@ -297,7 +292,7 @@ void ExpectFilledForm(int page_id, bool has_credit_card_fields, bool use_month_type) { // The number of fields in the address and credit card forms created above. - const size_t kAddressFormSize = 12; + const size_t kAddressFormSize = 11; const size_t kCreditCardFormSize = use_month_type ? 3 : 4; EXPECT_EQ(expected_page_id, page_id); @@ -340,10 +335,8 @@ void ExpectFilledForm(int page_id, filled_form.fields[8]); ExpectFilledField("Phone Number", "phonenumber", phone, "tel", filled_form.fields[9]); - ExpectFilledField("Fax", "fax", fax, "text", - filled_form.fields[10]); ExpectFilledField("Email", "email", email, "email", - filled_form.fields[11]); + filled_form.fields[10]); } if (has_credit_card_fields) { @@ -376,7 +369,7 @@ void ExpectFilledAddressFormElvis(int page_id, bool has_credit_card_fields) { ExpectFilledForm(page_id, filled_form, expected_page_id, "Elvis", "Aaron", "Presley", "3734 Elvis Presley Blvd.", "Apt. 10", "Memphis", - "Tennessee", "38116", "United States", "12345678901", "", + "Tennessee", "38116", "United States", "12345678901", "theking@gmail.com", "", "", "", "", true, has_credit_card_fields, false); } @@ -386,7 +379,7 @@ void ExpectFilledCreditCardFormElvis(int page_id, int expected_page_id, bool has_address_fields) { ExpectFilledForm(page_id, filled_form, expected_page_id, - "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "Elvis Presley", "4234567890123456", "04", "2012", has_address_fields, true, false); } @@ -398,7 +391,7 @@ void ExpectFilledCreditCardYearMonthWithYearMonth(int page_id, const char* year, const char* month) { ExpectFilledForm(page_id, filled_form, expected_page_id, - "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "Miku Hatsune", "4234567890654321", month, year, has_address_fields, true, true); } @@ -1371,8 +1364,8 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsWithDuplicateValues) { // |profile| will be owned by the mock PersonalDataManager. AutofillProfile* profile = new AutofillProfile; - autofill_test::SetProfileInfo(profile, "Elvis", "", "", "", "", - "", "", "", "", "", "", "", ""); + autofill_test::SetProfileInfo(profile, "Elvis", "", "", "", "", "", "", "", + "", "", "", ""); profile->set_guid("00000000-0000-0000-0000-000000000101"); autofill_manager_->AddProfile(profile); @@ -1415,7 +1408,7 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsForMultiValuedProfileUnfilled) { // |profile| will be owned by the mock PersonalDataManager. AutofillProfile* profile = new AutofillProfile; autofill_test::SetProfileInfo(profile, "Elvis", "", "Presley", "me@x.com", "", - "", "", "", "", "", "", "", ""); + "", "", "", "", "", "", ""); profile->set_guid("00000000-0000-0000-0000-000000000101"); std::vector<string16> multi_values(2); multi_values[0] = ASCIIToUTF16("Elvis Presley"); @@ -2060,8 +2053,8 @@ TEST_F(AutofillManagerTest, FillAutofilledForm) { { SCOPED_TRACE("Address"); ExpectFilledForm(page_id, results, kDefaultPageID, - "Elvis", "", "", "", "", "", "", "", "", "", "", "", - "", "", "", "", true, true, false); + "Elvis", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", true, true, false); } // Now fill the credit card data. @@ -2096,8 +2089,8 @@ TEST_F(AutofillManagerTest, FillAutofilledForm) { { SCOPED_TRACE("Credit card 2"); ExpectFilledForm(page_id, results, kPageID3, - "", "", "", "", "", "", "", "", "", "", "", "", - "", "", "", "2012", true, true, false); + "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "2012", true, true, false); } } @@ -2255,15 +2248,16 @@ TEST_F(AutofillManagerTest, FormChangesRemoveField) { // Test that we can still fill a form when a field has been added to it. TEST_F(AutofillManagerTest, FormChangesAddField) { - // The offset of the fax field in the address form. - const int kFaxFieldOffset = 10; + // The offset of the phone field in the address form. + const int kPhoneFieldOffset = 9; // Set up our form data. FormData form; CreateTestAddressFormData(&form); - // Remove the fax field -- we'll add it back later. - std::vector<FormField>::iterator pos = form.fields.begin() + kFaxFieldOffset; + // Remove the phone field -- we'll add it back later. + std::vector<FormField>::iterator pos = + form.fields.begin() + kPhoneFieldOffset; FormField field = *pos; pos = form.fields.erase(pos); @@ -2747,8 +2741,7 @@ TEST_F(AutofillManagerTest, DeterminePossibleFieldTypesForUploadStressTest) { StringPrintf("%d 1st st.", i).c_str(), "", "Memphis", "Tennessee", "38116", "USA", - StringPrintf("650234%04d", i).c_str(), - ""); + StringPrintf("650234%04d", i).c_str()); profile->set_guid( StringPrintf("00000000-0000-0000-0001-00000000%04d", i).c_str()); test_personal_data_->AddProfile(profile); diff --git a/chrome/browser/autofill/autofill_merge_unittest.cc b/chrome/browser/autofill/autofill_merge_unittest.cc index e1d364f..6f676d7 100644 --- a/chrome/browser/autofill/autofill_merge_unittest.cc +++ b/chrome/browser/autofill/autofill_merge_unittest.cc @@ -39,8 +39,7 @@ const AutofillFieldType kProfileFieldTypes[] = { ADDRESS_HOME_STATE, ADDRESS_HOME_ZIP, ADDRESS_HOME_COUNTRY, - PHONE_HOME_WHOLE_NUMBER, - PHONE_FAX_WHOLE_NUMBER, + PHONE_HOME_WHOLE_NUMBER }; // Serializes the |profiles| into a string. diff --git a/chrome/browser/autofill/autofill_metrics.cc b/chrome/browser/autofill/autofill_metrics.cc index dae51a2..af13ca4 100644 --- a/chrome/browser/autofill/autofill_metrics.cc +++ b/chrome/browser/autofill/autofill_metrics.cc @@ -42,7 +42,7 @@ enum FieldTypeGroupForMetrics { ADDRESS_ZIP, ADDRESS_COUNTRY, PHONE, - FAX, + FAX, // Deprecated. EMAIL, CREDIT_CARD_NAME, CREDIT_CARD_NUMBER, @@ -124,10 +124,6 @@ int GetFieldTypeGroupMetric(const AutofillFieldType field_type, group = PHONE; break; - case AutofillType::PHONE_FAX: - group = FAX; - break; - case AutofillType::CREDIT_CARD: switch (field_type) { case ::CREDIT_CARD_NAME: diff --git a/chrome/browser/autofill/autofill_metrics_unittest.cc b/chrome/browser/autofill/autofill_metrics_unittest.cc index 2015888..0f929da 100644 --- a/chrome/browser/autofill/autofill_metrics_unittest.cc +++ b/chrome/browser/autofill/autofill_metrics_unittest.cc @@ -117,15 +117,14 @@ class TestPersonalDataManager : public PersonalDataManager { "Presley", "theking@gmail.com", "RCA", "3734 Elvis Presley Blvd.", "Apt. 10", "Memphis", "Tennessee", "38116", "USA", - "12345678901", ""); + "12345678901"); profile->set_guid("00000000-0000-0000-0000-000000000001"); profiles->push_back(profile); profile = new AutofillProfile; autofill_test::SetProfileInfo(profile, "Charles", "Hardin", "Holley", "buddy@gmail.com", "Decca", "123 Apple St.", "unit 6", "Lubbock", - "Texas", "79401", "USA", "2345678901", - ""); + "Texas", "79401", "USA", "2345678901"); profile->set_guid("00000000-0000-0000-0000-000000000002"); profiles->push_back(profile); } diff --git a/chrome/browser/autofill/autofill_profile.cc b/chrome/browser/autofill/autofill_profile.cc index 2656594..368b4e6 100644 --- a/chrome/browser/autofill/autofill_profile.cc +++ b/chrome/browser/autofill/autofill_profile.cc @@ -56,7 +56,6 @@ void GetFieldsForDistinguishingProfiles( ADDRESS_HOME_COUNTRY, EMAIL_ADDRESS, PHONE_HOME_WHOLE_NUMBER, - PHONE_FAX_WHOLE_NUMBER, COMPANY_NAME, }; @@ -167,14 +166,6 @@ void CollapseCompoundFieldTypes(FieldTypeSet* type_set) { collapsed_set.insert(PHONE_HOME_WHOLE_NUMBER); break; - case PHONE_FAX_NUMBER: - case PHONE_FAX_CITY_CODE: - case PHONE_FAX_COUNTRY_CODE: - case PHONE_FAX_CITY_AND_NUMBER: - case PHONE_FAX_WHOLE_NUMBER: - collapsed_set.insert(PHONE_FAX_WHOLE_NUMBER); - break; - default: collapsed_set.insert(*iter); } @@ -208,16 +199,14 @@ AutofillProfile::AutofillProfile(const std::string& guid) : guid_(guid), name_(1), email_(1), - home_number_(1, PhoneNumber(AutofillType::PHONE_HOME, this)), - fax_number_(1, PhoneNumber(AutofillType::PHONE_FAX, this)) { + home_number_(1, PhoneNumber(this)) { } AutofillProfile::AutofillProfile() : guid_(guid::GenerateGUID()), name_(1), email_(1), - home_number_(1, PhoneNumber(AutofillType::PHONE_HOME, this)), - fax_number_(1, PhoneNumber(AutofillType::PHONE_FAX, this)) { + home_number_(1, PhoneNumber(this)) { } AutofillProfile::AutofillProfile(const AutofillProfile& profile) @@ -239,13 +228,10 @@ AutofillProfile& AutofillProfile::operator=(const AutofillProfile& profile) { email_ = profile.email_; company_ = profile.company_; home_number_ = profile.home_number_; - for (size_t i = 0; i < home_number_.size(); ++i) { + + for (size_t i = 0; i < home_number_.size(); ++i) home_number_[i].set_profile(this); - } - fax_number_ = profile.fax_number_; - for (size_t i = 0; i < fax_number_.size(); ++i) { - fax_number_[i].set_profile(this); - } + address_ = profile.address_; return *this; @@ -313,13 +299,7 @@ void AutofillProfile::SetMultiInfo(AutofillFieldType type, CopyValuesToItems(type, values, &home_number_, - PhoneNumber(AutofillType::PHONE_HOME, this)); - break; - case AutofillType::PHONE_FAX: - CopyValuesToItems(type, - values, - &fax_number_, - PhoneNumber(AutofillType::PHONE_FAX, this)); + PhoneNumber(this)); break; default: if (values.size() == 1) { @@ -357,9 +337,6 @@ void AutofillProfile::GetMultiInfoImpl(AutofillFieldType type, case AutofillType::PHONE_HOME: CopyItemsToValues(type, home_number_, canonicalize, values); break; - case AutofillType::PHONE_FAX: - CopyItemsToValues(type, fax_number_, canonicalize, values); - break; default: values->resize(1); (*values)[0] = GetInfo(type); @@ -371,8 +348,7 @@ bool AutofillProfile::SupportsMultiValue(AutofillFieldType type) { AutofillType::FieldTypeGroup group = AutofillType(type).group(); return group == AutofillType::NAME || group == AutofillType::EMAIL || - group == AutofillType::PHONE_HOME || - group == AutofillType::PHONE_FAX; + group == AutofillType::PHONE_HOME; } const string16 AutofillProfile::Label() const { @@ -470,8 +446,7 @@ int AutofillProfile::Compare(const AutofillProfile& profile) const { ADDRESS_HOME_STATE, ADDRESS_HOME_ZIP, ADDRESS_HOME_COUNTRY, - PHONE_HOME_NUMBER, - PHONE_FAX_NUMBER }; + PHONE_HOME_NUMBER }; for (size_t index = 0; index < arraysize(types); ++index) { int comparison = GetInfo(types[index]).compare( @@ -503,8 +478,7 @@ int AutofillProfile::CompareMulti(const AutofillProfile& profile) const { NAME_MIDDLE, NAME_LAST, EMAIL_ADDRESS, - PHONE_HOME_NUMBER, - PHONE_FAX_NUMBER }; + PHONE_HOME_NUMBER }; for (size_t i = 0; i < arraysize(multi_value_types); ++i) { std::vector<string16> values_a; @@ -567,8 +541,7 @@ void AutofillProfile::OverwriteWithOrAddTo(const AutofillProfile& profile) { for (std::vector<string16>::iterator value_iter = new_values.begin(); value_iter != new_values.end(); ++value_iter) { // Don't add duplicates. - if (group == AutofillType::PHONE_HOME || - group == AutofillType::PHONE_FAX) { + if (group == AutofillType::PHONE_HOME) { AddPhoneIfUnique(*value_iter, &existing_values); } else { std::vector<string16>::const_iterator existing_iter = std::find_if( @@ -617,11 +590,6 @@ string16 AutofillProfile::ConstructInferredLabel( if (!label.empty()) label.append(separator); - // Fax number has special format, to indicate that this is a fax number. - if (*it == PHONE_FAX_WHOLE_NUMBER) { - field = l10n_util::GetStringFUTF16( - IDS_AUTOFILL_DIALOG_ADDRESS_SUMMARY_FAX_FORMAT, field); - } label.append(field); ++num_fields_used; } @@ -706,13 +674,12 @@ void AutofillProfile::CreateDifferentiatingLabels( } AutofillProfile::FormGroupList AutofillProfile::FormGroups() const { - FormGroupList v(6); + FormGroupList v(5); v[0] = &name_[0]; v[1] = &email_[0]; v[2] = &company_; v[3] = &home_number_[0]; - v[4] = &fax_number_[0]; - v[5] = &address_; + v[4] = &address_; return v; } @@ -736,9 +703,6 @@ FormGroup* AutofillProfile::MutableFormGroupForType(AutofillFieldType type) { case AutofillType::PHONE_HOME: form_group = &home_number_[0]; break; - case AutofillType::PHONE_FAX: - form_group = &fax_number_[0]; - break; case AutofillType::ADDRESS_HOME: form_group = &address_; break; @@ -777,7 +741,5 @@ std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile) { << " " << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_COUNTRY)) << " " - << UTF16ToUTF8(MultiString(profile, PHONE_HOME_WHOLE_NUMBER)) - << " " - << UTF16ToUTF8(MultiString(profile, PHONE_FAX_WHOLE_NUMBER)); + << UTF16ToUTF8(MultiString(profile, PHONE_HOME_WHOLE_NUMBER)); } diff --git a/chrome/browser/autofill/autofill_profile.h b/chrome/browser/autofill/autofill_profile.h index 4dbb94a..69efbaa 100644 --- a/chrome/browser/autofill/autofill_profile.h +++ b/chrome/browser/autofill/autofill_profile.h @@ -16,10 +16,9 @@ #include "chrome/browser/autofill/address.h" #include "chrome/browser/autofill/autofill_type.h" #include "chrome/browser/autofill/contact_info.h" -#include "chrome/browser/autofill/fax_number.h" #include "chrome/browser/autofill/field_types.h" #include "chrome/browser/autofill/form_group.h" -#include "chrome/browser/autofill/home_phone_number.h" +#include "chrome/browser/autofill/phone_number.h" // A collection of FormGroups stored in a profile. AutofillProfile also // implements the FormGroup interface so that owners of this object can request @@ -75,8 +74,7 @@ class AutofillProfile : public FormGroup { // 2. Address. // 3. E-mail. // 4. Phone. - // 5. Fax. - // 6. Company name. + // 5. Company name. // Profile labels are changed accordingly to these rules. // Returns true if any of the profiles were updated. // This function is useful if you want to adjust unique labels for all @@ -130,7 +128,7 @@ class AutofillProfile : public FormGroup { private: typedef std::vector<const FormGroup*> FormGroupList; - // FormGroup: + // FormGroup implementation. virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; // Shared implementation for GetMultiInfo() and GetCanonicalizedMultiInfo(). @@ -181,7 +179,6 @@ class AutofillProfile : public FormGroup { std::vector<EmailInfo> email_; CompanyInfo company_; std::vector<PhoneNumber> home_number_; - std::vector<PhoneNumber> fax_number_; Address address_; }; diff --git a/chrome/browser/autofill/autofill_profile_unittest.cc b/chrome/browser/autofill/autofill_profile_unittest.cc index 6c1297e..cb63d50 100644 --- a/chrome/browser/autofill/autofill_profile_unittest.cc +++ b/chrome/browser/autofill/autofill_profile_unittest.cc @@ -41,7 +41,7 @@ TEST_F(AutofillProfileTest, PreviewSummaryString) { AutofillProfile profile00; autofill_test::SetProfileInfo(&profile00, "", "Mitchell", "", "johnwayne@me.xyz", "Fox", "", "", "Hollywood", "CA", "91601", "US", - "16505678910", "78127654321"); + "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile00)); string16 summary00 = profile00.Label(); EXPECT_EQ(ASCIIToUTF16("Hollywood, CA"), summary00); @@ -50,7 +50,7 @@ TEST_F(AutofillProfileTest, PreviewSummaryString) { AutofillProfile profile1; autofill_test::SetProfileInfo(&profile1, "", "Mitchell", "", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "", "Hollywood", "CA", - "91601", "US", "16505678910", "78127654321"); + "91601", "US", "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile1)); string16 summary1 = profile1.Label(); EXPECT_EQ(ASCIIToUTF16("123 Zoo St., Hollywood"), summary1); @@ -59,7 +59,7 @@ TEST_F(AutofillProfileTest, PreviewSummaryString) { AutofillProfile profile1a; autofill_test::SetProfileInfo(&profile1a, "", "Mitchell", "", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", - "91601", "US", "16505678910", "78127654321"); + "91601", "US", "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile1a)); string16 summary1a = profile1a.Label(); EXPECT_EQ(ASCIIToUTF16("123 Zoo St., unit 5"), summary1a); @@ -68,7 +68,7 @@ TEST_F(AutofillProfileTest, PreviewSummaryString) { AutofillProfile profile2; autofill_test::SetProfileInfo(&profile2, "", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "", "", "Hollywood", "CA", - "91601", "US", "16505678910", "78127654321"); + "91601", "US", "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile2)); string16 summary2 = profile2.Label(); // Summary does include full name which is empty if the first name is empty. @@ -78,7 +78,7 @@ TEST_F(AutofillProfileTest, PreviewSummaryString) { AutofillProfile profile3; autofill_test::SetProfileInfo(&profile3, "", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "", - "Hollywood", "CA", "91601", "US", "16505678910", "78127654321"); + "Hollywood", "CA", "91601", "US", "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile3)); string16 summary3 = profile3.Label(); EXPECT_EQ(ASCIIToUTF16("123 Zoo St., Hollywood"), summary3); @@ -87,7 +87,7 @@ TEST_F(AutofillProfileTest, PreviewSummaryString) { AutofillProfile profile4; autofill_test::SetProfileInfo(&profile4, "Marion", "Mitchell", "", "johnwayne@me.xyz", "Fox", "", "", "Hollywood", "CA", "91601", "US", - "16505678910", "01987654321"); + "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile4)); string16 summary4 = profile4.Label(); EXPECT_EQ(ASCIIToUTF16("Marion Mitchell, Hollywood"), summary4); @@ -96,7 +96,7 @@ TEST_F(AutofillProfileTest, PreviewSummaryString) { AutofillProfile profile5; autofill_test::SetProfileInfo(&profile5, "Marion", "Mitchell", "", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", - "91601", "US", "16505678910", "78127654321"); + "91601", "US", "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile5)); string16 summary5 = profile5.Label(); EXPECT_EQ(ASCIIToUTF16("Marion Mitchell, 123 Zoo St."), summary5); @@ -105,7 +105,7 @@ TEST_F(AutofillProfileTest, PreviewSummaryString) { AutofillProfile profile6; autofill_test::SetProfileInfo(&profile6, "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "", "", "Hollywood", "CA", - "91601", "US", "16505678910", "78127654321"); + "91601", "US", "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile6)); string16 summary6 = profile6.Label(); EXPECT_EQ(ASCIIToUTF16("Marion Mitchell Morrison, Hollywood"), @@ -115,7 +115,7 @@ TEST_F(AutofillProfileTest, PreviewSummaryString) { AutofillProfile profile7; autofill_test::SetProfileInfo(&profile7, "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", - "Hollywood", "CA", "91601", "US", "16505678910", "78127654321"); + "Hollywood", "CA", "91601", "US", "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile7)); string16 summary7 = profile7.Label(); EXPECT_EQ(ASCIIToUTF16("Marion Mitchell Morrison, 123 Zoo St."), @@ -126,7 +126,7 @@ TEST_F(AutofillProfileTest, PreviewSummaryString) { AutofillProfile profile7a; autofill_test::SetProfileInfo(&profile7a, "Marion", "Mitchell", "Morrison", "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5", - "Hollywood", "CA", "91601", "US", "16505678910", "78127654321"); + "Hollywood", "CA", "91601", "US", "16505678910"); std::vector<AutofillProfile*> profiles; profiles.push_back(&profile7); profiles.push_back(&profile7a); @@ -154,8 +154,7 @@ TEST_F(AutofillProfileTest, AdjustInferredLabels) { "Elysium", "CA", "91111", "US", - "16502111111", - "16502222222"); + "16502111111"); profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo( profiles[1], @@ -169,8 +168,7 @@ TEST_F(AutofillProfileTest, AdjustInferredLabels) { "Dis", "CA", "91222", "US", - "12345678910", - "01987654321"); + "12345678910"); // As labels are empty they are adjusted the first time. EXPECT_TRUE(AutofillProfile::AdjustInferredLabels(&profiles)); // No need to adjust them anymore. @@ -193,8 +191,7 @@ TEST_F(AutofillProfileTest, AdjustInferredLabels) { "Elysium", "CA", "91111", "US", - "16502111111", - "16502222222"); + "16502111111"); EXPECT_TRUE(AutofillProfile::AdjustInferredLabels(&profiles)); // Profile 0 and 2 inferred label now includes an e-mail. @@ -218,20 +215,19 @@ TEST_F(AutofillProfileTest, AdjustInferredLabels) { "Underworld", "666 Erebus St.", "", - "Elysium", "CA", + "Elysium", "CO", // State is different "91111", "US", - "16502111111", - "16503333333"); // Fax is different + "16502111111"); EXPECT_TRUE(AutofillProfile::AdjustInferredLabels(&profiles)); - // Profile 0 and 2 inferred label now includes a fax number. - EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., fax:#16502222222"), + // Profile 0 and 2 inferred label now includes a state. + EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., CA"), profiles[0]->Label()); EXPECT_EQ(ASCIIToUTF16("Jane Doe, 123 Letha Shore."), profiles[1]->Label()); - EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., fax:#16503333333"), + EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., CO"), profiles[2]->Label()); profiles.push_back(new AutofillProfile); @@ -244,25 +240,22 @@ TEST_F(AutofillProfileTest, AdjustInferredLabels) { "Underworld", "666 Erebus St.", "", - "Elysium", "CA", + "Elysium", "CO", // State is different for some. "91111", "US", - "16504444444", // Phone is different for some. - "16503333333"); // Fax is different for some. + "16504444444"); // Phone is different for some. EXPECT_TRUE(AutofillProfile::AdjustInferredLabels(&profiles)); - EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., 16502111111," - " fax:#16502222222"), + EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., CA"), profiles[0]->Label()); EXPECT_EQ(ASCIIToUTF16("Jane Doe, 123 Letha Shore."), profiles[1]->Label()); - EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., 16502111111," - " fax:#16503333333"), + EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., CO, 16502111111"), profiles[2]->Label()); // This one differs from other ones by unique phone, so no need for extra // information. - EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., 16504444444"), + EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., CO, 16504444444"), profiles[3]->Label()); profiles.push_back(new AutofillProfile); @@ -275,28 +268,26 @@ TEST_F(AutofillProfileTest, AdjustInferredLabels) { "Underworld", "666 Erebus St.", "", - "Elysium", "CA", + "Elysium", "CO", // State is different for some. "91111", "US", - "16504444444", // Phone is different for some. - "16503333333"); // Fax is different for some. + "16504444444"); // Phone is different for some. EXPECT_TRUE(AutofillProfile::AdjustInferredLabels(&profiles)); - EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., johndoe@hades.com," - " 16502111111, fax:#16502222222"), + EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., CA"), profiles[0]->Label()); EXPECT_EQ(ASCIIToUTF16("Jane Doe, 123 Letha Shore."), profiles[1]->Label()); - EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., johndoe@hades.com," - " 16502111111, fax:#16503333333"), + EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., CO, johndoe@hades.com," + " 16502111111"), profiles[2]->Label()); - EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., johndoe@hades.com," - " 16504444444, fax:#16503333333"), + EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., CO, johndoe@hades.com," + " 16504444444"), profiles[3]->Label()); // This one differs from other ones by unique e-mail, so no need for extra // information. - EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., johndoe@styx.com"), + EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., CO, johndoe@styx.com"), profiles[4]->Label()); EXPECT_FALSE(AutofillProfile::AdjustInferredLabels(&profiles)); @@ -319,8 +310,7 @@ TEST_F(AutofillProfileTest, CreateInferredLabels) { "Elysium", "CA", "91111", "US", - "16502111111", - "16502222222"); + "16502111111"); profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[1], "Jane", @@ -333,8 +323,7 @@ TEST_F(AutofillProfileTest, CreateInferredLabels) { "Dis", "CA", "91222", "US", - "12345678910", - "01987654321"); + "12345678910"); std::vector<string16> labels; // Two fields at least - no filter. AutofillProfile::CreateInferredLabels(&profiles, NULL, UNKNOWN_TYPE, 2, @@ -421,11 +410,11 @@ TEST_F(AutofillProfileTest, CreateInferredLabelsFallsBackToFullName) { profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[0], "John", "", "Doe", "doe@example.com", "", - "88 Nowhere Ave.", "", "", "", "", "", "", ""); + "88 Nowhere Ave.", "", "", "", "", "", ""); profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[1], "Johnny", "K", "Doe", "doe@example.com", "", - "88 Nowhere Ave.", "", "", "", "", "", "", ""); + "88 Nowhere Ave.", "", "", "", "", "", ""); // If the only name field in the suggested fields is the excluded field, we // should not fall back to the full name as a distinguishing field. @@ -455,11 +444,11 @@ TEST_F(AutofillProfileTest, CreateInferredLabelsNoDuplicatedFields) { profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[0], "John", "", "Doe", "doe@example.com", "", - "88 Nowhere Ave.", "", "", "", "", "", "", ""); + "88 Nowhere Ave.", "", "", "", "", "", ""); profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[1], "John", "", "Doe", "dojo@example.com", "", - "88 Nowhere Ave.", "", "", "", "", "", "", ""); + "88 Nowhere Ave.", "", "", "", "", "", ""); // If the only name field in the suggested fields is the excluded field, we // should not fall back to the full name as a distinguishing field. @@ -481,15 +470,15 @@ TEST_F(AutofillProfileTest, CreateInferredLabelsSkipsEmptyFields) { profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[0], "John", "", "Doe", "doe@example.com", - "Gogole", "", "", "", "", "", "", "", ""); + "Gogole", "", "", "", "", "", "", ""); profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[1], "John", "", "Doe", "doe@example.com", - "Ggoole", "", "", "", "", "", "", "", ""); + "Ggoole", "", "", "", "", "", "", ""); profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[2], "John", "", "Doe", "john.doe@example.com", - "Goolge", "", "", "", "", "", "", "", ""); + "Goolge", "", "", "", "", "", "", ""); std::vector<string16> labels; AutofillProfile::CreateInferredLabels(&profiles.get(), NULL, UNKNOWN_TYPE, 3, @@ -519,10 +508,10 @@ TEST_F(AutofillProfileTest, IsSubsetOf) { b.reset(new AutofillProfile); autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson", "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL); + NULL); autofill_test::SetProfileInfo(b.get(), "Thomas", NULL, "Jefferson", "declaration_guy@gmail.com", "United States Government", "Monticello", - NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, NULL); + NULL, "Charlottesville", "Virginia", "22902", NULL, NULL); EXPECT_TRUE(a->IsSubsetOf(*b)); // |b| is not a subset of |a|. @@ -536,10 +525,10 @@ TEST_F(AutofillProfileTest, IsSubsetOf) { b.reset(new AutofillProfile); autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson", "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL); + NULL); autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Adams", "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL); + NULL); EXPECT_FALSE(a->IsSubsetOf(*b)); } @@ -553,10 +542,10 @@ TEST_F(AutofillProfileTest, IntersectionOfTypesHasEqualValues) { b.reset(new AutofillProfile); autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson", "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, - "12134759123", "19384284720"); + "12134759123"); autofill_test::SetProfileInfo(b.get(), "Thomas", NULL, "Jefferson", "declaration_guy@gmail.com", "United States Government", "Monticello", - NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, NULL); + NULL, "Charlottesville", "Virginia", "22902", NULL, NULL); EXPECT_TRUE(a->IntersectionOfTypesHasEqualValues(*b)); // Intersection of types contains the fields NAME_FIRST, NAME_LAST, @@ -565,10 +554,10 @@ TEST_F(AutofillProfileTest, IntersectionOfTypesHasEqualValues) { b.reset(new AutofillProfile); autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson", "poser@yahoo.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, - "12134759123", "19384284720"); + "12134759123"); autofill_test::SetProfileInfo(b.get(), "Thomas", NULL, "Jefferson",\ "declaration_guy@gmail.com", "United States Government", "Monticello", - NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, NULL); + NULL, "Charlottesville", "Virginia", "22902", NULL, NULL); EXPECT_FALSE(a->IntersectionOfTypesHasEqualValues(*b)); // Intersection of types is empty. @@ -576,10 +565,10 @@ TEST_F(AutofillProfileTest, IntersectionOfTypesHasEqualValues) { b.reset(new AutofillProfile); autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson", "poser@yahoo.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, - "12134759123", "19384284720"); + "12134759123"); autofill_test::SetProfileInfo(b.get(), NULL, NULL, NULL, NULL, "United States Government", "Monticello", NULL, "Charlottesville", - "Virginia", "22902", NULL, NULL, NULL); + "Virginia", "22902", NULL, NULL); EXPECT_FALSE(a->IntersectionOfTypesHasEqualValues(*b)); } @@ -590,18 +579,17 @@ TEST_F(AutofillProfileTest, MergeWith) { a.reset(new AutofillProfile); b.reset(new AutofillProfile); autofill_test::SetProfileInfo(a.get(), "Jimmy", NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, "12134759123", "19384284720"); + NULL, NULL, NULL, NULL, NULL, NULL, NULL, "12134759123"); autofill_test::SetProfileInfo(b.get(), "James", NULL, "Madison", "constitutionalist@gmail.com", "United States Government", "Monticello", - NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, NULL); + NULL, "Charlottesville", "Virginia", "22902", NULL, NULL); AutofillProfile expected_b(*b); a->MergeWith(*b); AutofillProfile expected_a; autofill_test::SetProfileInfo(&expected_a, "Jimmy", NULL, "Madison", "constitutionalist@gmail.com", "United States Government", "Monticello", - NULL, "Charlottesville", "Virginia", "22902", NULL, "12134759123", - "19384284720"); + NULL, "Charlottesville", "Virginia", "22902", NULL, "12134759123"); EXPECT_EQ(0, expected_a.Compare(*a)); EXPECT_EQ(0, expected_b.Compare(*b)); } @@ -612,8 +600,8 @@ TEST_F(AutofillProfileTest, AssignmentOperator){ // Result of assignment should be logically equal to the original profile. autofill_test::SetProfileInfo(&a, "Marion", "Mitchell", "Morrison", "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5", - "Hollywood", "CA", "91601", "US", "12345678910", - "01987654321"); + "Hollywood", "CA", "91601", "US", + "12345678910"); b = a; EXPECT_TRUE(a == b); @@ -628,8 +616,8 @@ TEST_F(AutofillProfileTest, Copy) { // Clone should be logically equal to the original. autofill_test::SetProfileInfo(&a, "Marion", "Mitchell", "Morrison", "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5", - "Hollywood", "CA", "91601", "US", "12345678910", - "01987654321"); + "Hollywood", "CA", "91601", "US", + "12345678910"); AutofillProfile b(a); EXPECT_TRUE(a == b); } @@ -647,9 +635,9 @@ TEST_F(AutofillProfileTest, Compare) { // Different values produce non-zero results. autofill_test::SetProfileInfo(&a, "Jimmy", NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); autofill_test::SetProfileInfo(&b, "Ringo", NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); EXPECT_GT(0, a.Compare(b)); EXPECT_LT(0, b.Compare(a)); } @@ -793,47 +781,3 @@ TEST_F(AutofillProfileTest, MultiValuePhone) { // Expect regular |GetInfo| returns empty value. EXPECT_EQ(string16(), p.GetInfo(PHONE_HOME_WHOLE_NUMBER)); } - -TEST_F(AutofillProfileTest, MultiValueFax) { - AutofillProfile p; - const string16 kJohnDoe(ASCIIToUTF16("4152112222")); - const string16 kJohnPDoe(ASCIIToUTF16("4153113333")); - std::vector<string16> set_values; - set_values.push_back(kJohnDoe); - set_values.push_back(kJohnPDoe); - p.SetMultiInfo(PHONE_FAX_WHOLE_NUMBER, set_values); - - // Expect regular |GetInfo| returns the first element. - EXPECT_EQ(kJohnDoe, p.GetInfo(PHONE_FAX_WHOLE_NUMBER)); - - // Ensure that we get out what we put in. - std::vector<string16> get_values; - p.GetMultiInfo(PHONE_FAX_WHOLE_NUMBER, &get_values); - ASSERT_EQ(2UL, get_values.size()); - EXPECT_EQ(kJohnDoe, get_values[0]); - EXPECT_EQ(kJohnPDoe, get_values[1]); - - // Update the values. - AutofillProfile p2 = p; - EXPECT_EQ(0, p.Compare(p2)); - EXPECT_EQ(0, p.CompareMulti(p2)); - const string16 kNoOne(ASCIIToUTF16("4151110000")); - set_values[1] = kNoOne; - p.SetMultiInfo(PHONE_FAX_WHOLE_NUMBER, set_values); - p.GetMultiInfo(PHONE_FAX_WHOLE_NUMBER, &get_values); - ASSERT_EQ(2UL, get_values.size()); - EXPECT_EQ(kJohnDoe, get_values[0]); - EXPECT_EQ(kNoOne, get_values[1]); - EXPECT_EQ(0, p.Compare(p2)); - EXPECT_NE(0, p.CompareMulti(p2)); - - // Delete values. - set_values.clear(); - p.SetMultiInfo(PHONE_FAX_WHOLE_NUMBER, set_values); - p.GetMultiInfo(PHONE_FAX_WHOLE_NUMBER, &get_values); - ASSERT_EQ(1UL, get_values.size()); - EXPECT_EQ(string16(), get_values[0]); - - // Expect regular |GetInfo| returns empty value. - EXPECT_EQ(string16(), p.GetInfo(PHONE_FAX_WHOLE_NUMBER)); -} diff --git a/chrome/browser/autofill/autofill_type.cc b/chrome/browser/autofill/autofill_type.cc index b53d997..8aefd1c 100644 --- a/chrome/browser/autofill/autofill_type.cc +++ b/chrome/browser/autofill/autofill_type.cc @@ -52,16 +52,12 @@ AutofillType::AutofillTypeDefinition kAutofillTypeDefinitions[] = { { AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP }, { AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP }, - // PHONE_FAX_NUMBER - { AutofillType::PHONE_FAX, AutofillType::PHONE_NUMBER }, - // PHONE_FAX_CITY_CODE - { AutofillType::PHONE_FAX, AutofillType::PHONE_CITY_CODE }, - // PHONE_FAX_COUNTRY_CODE - { AutofillType::PHONE_FAX, AutofillType::PHONE_COUNTRY_CODE }, - // PHONE_FAX_CITY_AND_NUMBER - { AutofillType::PHONE_FAX, AutofillType::PHONE_CITY_AND_NUMBER }, - // PHONE_FAX_WHOLE_NUMBER - { AutofillType::PHONE_FAX, AutofillType::PHONE_WHOLE_NUMBER }, + // Fax numbers (values [20,24]) are deprecated. + { AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP }, + { AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP }, + { AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP }, + { AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP }, + { AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP }, // Cell phone numbers (values [25, 29]) are deprecated. { AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP }, @@ -231,16 +227,6 @@ std::string AutofillType::FieldTypeToString(AutofillFieldType type) { return "PHONE_HOME_CITY_AND_NUMBER"; case PHONE_HOME_WHOLE_NUMBER: return "PHONE_HOME_WHOLE_NUMBER"; - case PHONE_FAX_NUMBER: - return "PHONE_FAX_NUMBER"; - case PHONE_FAX_CITY_CODE: - return "PHONE_FAX_CITY_CODE"; - case PHONE_FAX_COUNTRY_CODE: - return "PHONE_FAX_COUNTRY_CODE"; - case PHONE_FAX_CITY_AND_NUMBER: - return "PHONE_FAX_CITY_AND_NUMBER"; - case PHONE_FAX_WHOLE_NUMBER: - return "PHONE_FAX_WHOLE_NUMBER"; case ADDRESS_HOME_LINE1: return "ADDRESS_HOME_LINE1"; case ADDRESS_HOME_LINE2: @@ -327,16 +313,6 @@ AutofillFieldType AutofillType::StringToFieldType(const std::string& str) { return PHONE_HOME_CITY_AND_NUMBER; if (str == "PHONE_HOME_WHOLE_NUMBER") return PHONE_HOME_WHOLE_NUMBER; - if (str == "PHONE_FAX_NUMBER") - return PHONE_FAX_NUMBER; - if (str == "PHONE_FAX_CITY_CODE") - return PHONE_FAX_CITY_CODE; - if (str == "PHONE_FAX_COUNTRY_CODE") - return PHONE_FAX_COUNTRY_CODE; - if (str == "PHONE_FAX_CITY_AND_NUMBER") - return PHONE_FAX_CITY_AND_NUMBER; - if (str == "PHONE_FAX_WHOLE_NUMBER") - return PHONE_FAX_WHOLE_NUMBER; if (str == "ADDRESS_HOME_LINE1") return ADDRESS_HOME_LINE1; if (str == "ADDRESS_HOME_LINE2") diff --git a/chrome/browser/autofill/autofill_type.h b/chrome/browser/autofill/autofill_type.h index da6c0b1..b543aca 100644 --- a/chrome/browser/autofill/autofill_type.h +++ b/chrome/browser/autofill/autofill_type.h @@ -25,7 +25,6 @@ class AutofillType { ADDRESS_HOME, ADDRESS_BILLING, PHONE_HOME, - PHONE_FAX, CREDIT_CARD, }; diff --git a/chrome/browser/autofill/fax_number.cc b/chrome/browser/autofill/fax_number.cc deleted file mode 100644 index baef644..0000000 --- a/chrome/browser/autofill/fax_number.cc +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/autofill/fax_number.h" - -FaxNumber::FaxNumber(AutofillProfile* profile) : PhoneNumber(profile) { -} - -FaxNumber::FaxNumber(const FaxNumber& fax) : PhoneNumber(fax) { -} - -FaxNumber::~FaxNumber() { -} - -FaxNumber& FaxNumber::operator=(const FaxNumber& fax) { - PhoneNumber::operator=(fax); - return *this; -} - -AutofillFieldType FaxNumber::GetNumberType() const { - return PHONE_FAX_NUMBER; -} - -AutofillFieldType FaxNumber::GetCityCodeType() const { - return PHONE_FAX_CITY_CODE; -} - -AutofillFieldType FaxNumber::GetCountryCodeType() const { - return PHONE_FAX_COUNTRY_CODE; -} - -AutofillFieldType FaxNumber::GetCityAndNumberType() const { - return PHONE_FAX_CITY_AND_NUMBER; -} - -AutofillFieldType FaxNumber::GetWholeNumberType() const { - return PHONE_FAX_WHOLE_NUMBER; -} diff --git a/chrome/browser/autofill/fax_number.h b/chrome/browser/autofill/fax_number.h deleted file mode 100644 index c65e7ae..0000000 --- a/chrome/browser/autofill/fax_number.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_AUTOFILL_FAX_NUMBER_H_ -#define CHROME_BROWSER_AUTOFILL_FAX_NUMBER_H_ -#pragma once - -#include "chrome/browser/autofill/field_types.h" -#include "chrome/browser/autofill/phone_number.h" - -class FaxNumber : public PhoneNumber { - public: - explicit FaxNumber(AutofillProfile* profile); - FaxNumber(const FaxNumber& fax); - virtual ~FaxNumber(); - - FaxNumber& operator=(const FaxNumber& fax); - - protected: - virtual AutofillFieldType GetNumberType() const; - virtual AutofillFieldType GetCityCodeType() const; - virtual AutofillFieldType GetCountryCodeType() const; - virtual AutofillFieldType GetCityAndNumberType() const; - virtual AutofillFieldType GetWholeNumberType() const; -}; - -#endif // CHROME_BROWSER_AUTOFILL_FAX_NUMBER_H_ diff --git a/chrome/browser/autofill/field_types.h b/chrome/browser/autofill/field_types.h index 7e1bc37..3d9564e 100644 --- a/chrome/browser/autofill/field_types.h +++ b/chrome/browser/autofill/field_types.h @@ -39,11 +39,7 @@ enum AutofillFieldType { // Work phone numbers (values [15,19]) are deprecated. - PHONE_FAX_NUMBER = 20, - PHONE_FAX_CITY_CODE = 21, - PHONE_FAX_COUNTRY_CODE = 22, - PHONE_FAX_CITY_AND_NUMBER = 23, - PHONE_FAX_WHOLE_NUMBER = 24, + // Fax numbers (values [20,24]) are deprecated. // Cell phone numbers (values [25, 29]) are deprecated. diff --git a/chrome/browser/autofill/form_field.cc b/chrome/browser/autofill/form_field.cc index 69bc5c8..4de1c80 100644 --- a/chrome/browser/autofill/form_field.cc +++ b/chrome/browser/autofill/form_field.cc @@ -55,7 +55,7 @@ void FormField::ParseFormFields(const std::vector<AutofillField*>& fields, // Email pass. ParseFormFieldsPass(EmailField::Parse, &remaining_fields, map); - // Phone/fax pass. + // Phone pass. ParseFormFieldsPass(PhoneField::Parse, &remaining_fields, map); // Address pass. diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc index 0bbe1db..407ac8d 100644 --- a/chrome/browser/autofill/form_structure.cc +++ b/chrome/browser/autofill/form_structure.cc @@ -197,43 +197,6 @@ bool UpdateFromAutocompleteType(const string16& autocomplete_type, return true; } - if (autocomplete_type == ASCIIToUTF16("fax-full")) { - field->set_heuristic_type(PHONE_FAX_WHOLE_NUMBER); - return true; - } - - if (autocomplete_type == ASCIIToUTF16("fax-country-code")) { - field->set_heuristic_type(PHONE_FAX_COUNTRY_CODE); - return true; - } - - if (autocomplete_type == ASCIIToUTF16("fax-national")) { - field->set_heuristic_type(PHONE_FAX_CITY_AND_NUMBER); - return true; - } - - if (autocomplete_type == ASCIIToUTF16("fax-area-code")) { - field->set_heuristic_type(PHONE_FAX_CITY_CODE); - return true; - } - - if (autocomplete_type == ASCIIToUTF16("fax-local")) { - field->set_heuristic_type(PHONE_FAX_NUMBER); - return true; - } - - if (autocomplete_type == ASCIIToUTF16("fax-local-prefix")) { - field->set_heuristic_type(PHONE_FAX_NUMBER); - field->set_phone_part(AutofillField::PHONE_PREFIX); - return true; - } - - if (autocomplete_type == ASCIIToUTF16("fax-local-suffix")) { - field->set_heuristic_type(PHONE_FAX_NUMBER); - field->set_phone_part(AutofillField::PHONE_SUFFIX); - return true; - } - if (autocomplete_type == ASCIIToUTF16("cc-full-name")) { field->set_heuristic_type(CREDIT_CARD_NAME); return true; @@ -694,8 +657,6 @@ void FormStructure::LogQualityMetrics( // international numbers. if (*it == PHONE_HOME_CITY_AND_NUMBER) collapsed_field_types.insert(PHONE_HOME_WHOLE_NUMBER); - else if (*it == PHONE_FAX_CITY_AND_NUMBER) - collapsed_field_types.insert(PHONE_FAX_WHOLE_NUMBER); else collapsed_field_types.insert(AutofillType::GetEquivalentFieldType(*it)); } @@ -978,12 +939,9 @@ void FormStructure::IdentifySections() { bool already_saw_current_type = seen_types.count(current_type) > 0; // Forms often ask for multiple phone numbers -- e.g. both a daytime and - // evening phone number. Our phone and fax number detection is also - // generally a little off. Hence, ignore both field types as a signal here. - AutofillType::FieldTypeGroup current_type_group = - AutofillType(current_type).group(); - if (current_type_group == AutofillType::PHONE_HOME || - current_type_group == AutofillType::PHONE_FAX) + // evening phone number. Our phone number detection is also generally a + // little off. Hence, ignore this field type as a signal here. + if (AutofillType(current_type).group() == AutofillType::PHONE_HOME) already_saw_current_type = false; // Some forms have adjacent fields of the same type. Two common examples: diff --git a/chrome/browser/autofill/form_structure_unittest.cc b/chrome/browser/autofill/form_structure_unittest.cc index 039826c..ec9c6ce 100644 --- a/chrome/browser/autofill/form_structure_unittest.cc +++ b/chrome/browser/autofill/form_structure_unittest.cc @@ -287,10 +287,6 @@ TEST(FormStructureTest, HeuristicsContactInfo) { field.name = ASCIIToUTF16("phone"); form.fields.push_back(field); - field.label = ASCIIToUTF16("Fax"); - field.name = ASCIIToUTF16("fax"); - form.fields.push_back(field); - field.label = ASCIIToUTF16("Address"); field.name = ASCIIToUTF16("address"); form.fields.push_back(field); @@ -313,8 +309,8 @@ TEST(FormStructureTest, HeuristicsContactInfo) { EXPECT_TRUE(form_structure->IsAutofillable(true)); // Expect the correct number of fields. - ASSERT_EQ(9U, form_structure->field_count()); - ASSERT_EQ(8U, form_structure->autofill_count()); + ASSERT_EQ(8U, form_structure->field_count()); + ASSERT_EQ(7U, form_structure->autofill_count()); // First name. EXPECT_EQ(NAME_FIRST, form_structure->field(0)->heuristic_type()); @@ -325,16 +321,14 @@ TEST(FormStructureTest, HeuristicsContactInfo) { // Phone. EXPECT_EQ(PHONE_HOME_WHOLE_NUMBER, form_structure->field(3)->heuristic_type()); - // Fax. - EXPECT_EQ(PHONE_FAX_WHOLE_NUMBER, form_structure->field(4)->heuristic_type()); // Address. - EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(5)->heuristic_type()); + EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(4)->heuristic_type()); // City. - EXPECT_EQ(ADDRESS_HOME_CITY, form_structure->field(6)->heuristic_type()); + EXPECT_EQ(ADDRESS_HOME_CITY, form_structure->field(5)->heuristic_type()); // Zip. - EXPECT_EQ(ADDRESS_HOME_ZIP, form_structure->field(7)->heuristic_type()); + EXPECT_EQ(ADDRESS_HOME_ZIP, form_structure->field(6)->heuristic_type()); // Submit. - EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(8)->heuristic_type()); + EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(7)->heuristic_type()); } // Verify that we can correctly process the |autocompletetype| attribute. @@ -396,7 +390,7 @@ TEST(FormStructureTest, HeuristicsAutocompletetypePhones) { field.label = string16(); field.name = ASCIIToUTF16("field3"); - field.autocomplete_type = ASCIIToUTF16("fax-local-suffix"); + field.autocomplete_type = ASCIIToUTF16("phone-local-suffix"); form.fields.push_back(field); form_structure.reset(new FormStructure(form)); @@ -412,7 +406,7 @@ TEST(FormStructureTest, HeuristicsAutocompletetypePhones) { EXPECT_EQ(PHONE_HOME_NUMBER, form_structure->field(1)->heuristic_type()); EXPECT_EQ(AutofillField::PHONE_PREFIX, form_structure->field(1)->phone_part()); - EXPECT_EQ(PHONE_FAX_NUMBER, form_structure->field(2)->heuristic_type()); + EXPECT_EQ(PHONE_HOME_NUMBER, form_structure->field(2)->heuristic_type()); EXPECT_EQ(AutofillField::PHONE_SUFFIX, form_structure->field(2)->phone_part()); } @@ -755,10 +749,6 @@ TEST(FormStructureTest, HeuristicsLabelsOnly) { field.name = string16(); form.fields.push_back(field); - field.label = ASCIIToUTF16("Fax"); - field.name = string16(); - form.fields.push_back(field); - field.label = ASCIIToUTF16("Address"); field.name = string16(); form.fields.push_back(field); @@ -779,8 +769,8 @@ TEST(FormStructureTest, HeuristicsLabelsOnly) { form_structure.reset(new FormStructure(form)); form_structure->DetermineHeuristicTypes(); EXPECT_TRUE(form_structure->IsAutofillable(true)); - ASSERT_EQ(9U, form_structure->field_count()); - ASSERT_EQ(8U, form_structure->autofill_count()); + ASSERT_EQ(8U, form_structure->field_count()); + ASSERT_EQ(7U, form_structure->autofill_count()); // First name. EXPECT_EQ(NAME_FIRST, form_structure->field(0)->heuristic_type()); @@ -791,16 +781,14 @@ TEST(FormStructureTest, HeuristicsLabelsOnly) { // Phone. EXPECT_EQ(PHONE_HOME_WHOLE_NUMBER, form_structure->field(3)->heuristic_type()); - // Fax. - EXPECT_EQ(PHONE_FAX_WHOLE_NUMBER, form_structure->field(4)->heuristic_type()); // Address. - EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(5)->heuristic_type()); + EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(4)->heuristic_type()); // Address Line 2. - EXPECT_EQ(ADDRESS_HOME_LINE2, form_structure->field(6)->heuristic_type()); + EXPECT_EQ(ADDRESS_HOME_LINE2, form_structure->field(5)->heuristic_type()); // Zip. - EXPECT_EQ(ADDRESS_HOME_ZIP, form_structure->field(7)->heuristic_type()); + EXPECT_EQ(ADDRESS_HOME_ZIP, form_structure->field(6)->heuristic_type()); // Submit. - EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(8)->heuristic_type()); + EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(7)->heuristic_type()); } TEST(FormStructureTest, HeuristicsCreditCardInfo) { @@ -1493,13 +1481,6 @@ TEST(FormStructureTest, EncodeUploadRequest) { form.fields.push_back(field); possible_field_types.push_back(FieldTypeSet()); possible_field_types.back().insert(ADDRESS_HOME_COUNTRY); - - field.label = ASCIIToUTF16("Fax"); - field.name = ASCIIToUTF16("fax"); - field.form_control_type = ASCIIToUTF16("tel"); - form.fields.push_back(field); - possible_field_types.push_back(FieldTypeSet()); - possible_field_types.back().insert(PHONE_FAX_WHOLE_NUMBER); form_structure.reset(new FormStructure(form)); ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); @@ -1516,35 +1497,32 @@ TEST(FormStructureTest, EncodeUploadRequest) { available_field_types.insert(ADDRESS_BILLING_LINE2); available_field_types.insert(EMAIL_ADDRESS); available_field_types.insert(PHONE_HOME_WHOLE_NUMBER); - available_field_types.insert(PHONE_FAX_WHOLE_NUMBER); std::string encoded_xml; EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, false, &encoded_xml)); EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\" " - "formsignature=\"7641728017676399335\" autofillused=\"false\" " - "datapresent=\"144200830e\">" + "formsignature=\"8736493185895608956\" autofillused=\"false\" " + "datapresent=\"144200030e\">" "<field signature=\"3763331450\" autofilltype=\"3\"/>" "<field signature=\"3494530716\" autofilltype=\"5\"/>" "<field signature=\"1029417091\" autofilltype=\"9\"/>" "<field signature=\"466116101\" autofilltype=\"14\"/>" "<field signature=\"2799270304\" autofilltype=\"36\"/>" - "<field signature=\"1876771436\" autofilltype=\"24\"/>" "</autofillupload>", encoded_xml); EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, true, &encoded_xml)); EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\" " - "formsignature=\"7641728017676399335\" autofillused=\"true\" " - "datapresent=\"144200830e\">" + "formsignature=\"8736493185895608956\" autofillused=\"true\" " + "datapresent=\"144200030e\">" "<field signature=\"3763331450\" autofilltype=\"3\"/>" "<field signature=\"3494530716\" autofilltype=\"5\"/>" "<field signature=\"1029417091\" autofilltype=\"9\"/>" "<field signature=\"466116101\" autofilltype=\"14\"/>" "<field signature=\"2799270304\" autofilltype=\"36\"/>" - "<field signature=\"1876771436\" autofilltype=\"24\"/>" "</autofillupload>", encoded_xml); @@ -1570,14 +1548,13 @@ TEST(FormStructureTest, EncodeUploadRequest) { &encoded_xml)); EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\" " - "formsignature=\"12226592129574322128\" autofillused=\"false\" " - "datapresent=\"144200830e\">" + "formsignature=\"7816485729218079147\" autofillused=\"false\" " + "datapresent=\"144200030e\">" "<field signature=\"3763331450\" autofilltype=\"3\"/>" "<field signature=\"3494530716\" autofilltype=\"5\"/>" "<field signature=\"1029417091\" autofilltype=\"9\"/>" "<field signature=\"466116101\" autofilltype=\"14\"/>" "<field signature=\"2799270304\" autofilltype=\"36\"/>" - "<field signature=\"1876771436\" autofilltype=\"24\"/>" "<field signature=\"509334676\" autofilltype=\"30\"/>" "<field signature=\"509334676\" autofilltype=\"31\"/>" "<field signature=\"509334676\" autofilltype=\"37\"/>" @@ -1686,8 +1663,8 @@ TEST(FormStructureTest, CheckDataPresence) { encoded_xml); // All supported non-credit card types available. - // datapresent should be "1f7e0f8378000008" == trimmmed(0x1f7e0f8378000008) == - // 0b0001111101111110000011111000001101111000000000000000000000001000 + // datapresent should be "1f7e000378000008" == trimmmed(0x1f7e000378000008) == + // 0b0001111101111110000000000000001101111000000000000000000000001000 // The set bits are: // 3 == NAME_FIRST // 4 == NAME_MIDDLE @@ -1700,11 +1677,6 @@ TEST(FormStructureTest, CheckDataPresence) { // 12 == PHONE_HOME_COUNTRY_CODE, // 13 == PHONE_HOME_CITY_AND_NUMBER, // 14 == PHONE_HOME_WHOLE_NUMBER, - // 20 == PHONE_FAX_NUMBER, - // 21 == PHONE_FAX_CITY_CODE, - // 22 == PHONE_FAX_COUNTRY_CODE, - // 23 == PHONE_FAX_CITY_AND_NUMBER, - // 24 == PHONE_FAX_WHOLE_NUMBER, // 30 == ADDRESS_HOME_LINE1 // 31 == ADDRESS_HOME_LINE2 // 33 == ADDRESS_HOME_CITY @@ -1724,11 +1696,6 @@ TEST(FormStructureTest, CheckDataPresence) { available_field_types.insert(PHONE_HOME_COUNTRY_CODE); available_field_types.insert(PHONE_HOME_CITY_AND_NUMBER); available_field_types.insert(PHONE_HOME_WHOLE_NUMBER); - available_field_types.insert(PHONE_FAX_NUMBER); - available_field_types.insert(PHONE_FAX_CITY_CODE); - available_field_types.insert(PHONE_FAX_COUNTRY_CODE); - available_field_types.insert(PHONE_FAX_CITY_AND_NUMBER); - available_field_types.insert(PHONE_FAX_WHOLE_NUMBER); available_field_types.insert(ADDRESS_HOME_LINE1); available_field_types.insert(ADDRESS_HOME_LINE2); available_field_types.insert(ADDRESS_HOME_CITY); @@ -1742,7 +1709,7 @@ TEST(FormStructureTest, CheckDataPresence) { EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" " formsignature=\"6402244543831589061\" autofillused=\"false\"" - " datapresent=\"1f7e0f8378000008\">" + " datapresent=\"1f7e000378000008\">" "<field signature=\"1089846351\" autofilltype=\"1\"/>" "<field signature=\"2404144663\" autofilltype=\"1\"/>" "<field signature=\"420638584\" autofilltype=\"1\"/>" @@ -1782,8 +1749,8 @@ TEST(FormStructureTest, CheckDataPresence) { encoded_xml); // All supported types available. - // datapresent should be "1f7e0f8378001fc8" == trimmmed(0x1f7e0f8378001fc8) == - // 0b0001111101111110000011111000001101111000000000000001111111001000 + // datapresent should be "1f7e000378001fc8" == trimmmed(0x1f7e000378001fc8) == + // 0b0001111101111110000000000000001101111000000000000001111111001000 // The set bits are: // 3 == NAME_FIRST // 4 == NAME_MIDDLE @@ -1796,11 +1763,6 @@ TEST(FormStructureTest, CheckDataPresence) { // 12 == PHONE_HOME_COUNTRY_CODE, // 13 == PHONE_HOME_CITY_AND_NUMBER, // 14 == PHONE_HOME_WHOLE_NUMBER, - // 20 == PHONE_FAX_NUMBER, - // 21 == PHONE_FAX_CITY_CODE, - // 22 == PHONE_FAX_COUNTRY_CODE, - // 23 == PHONE_FAX_CITY_AND_NUMBER, - // 24 == PHONE_FAX_WHOLE_NUMBER, // 30 == ADDRESS_HOME_LINE1 // 31 == ADDRESS_HOME_LINE2 // 33 == ADDRESS_HOME_CITY @@ -1827,11 +1789,6 @@ TEST(FormStructureTest, CheckDataPresence) { available_field_types.insert(PHONE_HOME_COUNTRY_CODE); available_field_types.insert(PHONE_HOME_CITY_AND_NUMBER); available_field_types.insert(PHONE_HOME_WHOLE_NUMBER); - available_field_types.insert(PHONE_FAX_NUMBER); - available_field_types.insert(PHONE_FAX_CITY_CODE); - available_field_types.insert(PHONE_FAX_COUNTRY_CODE); - available_field_types.insert(PHONE_FAX_CITY_AND_NUMBER); - available_field_types.insert(PHONE_FAX_WHOLE_NUMBER); available_field_types.insert(ADDRESS_HOME_LINE1); available_field_types.insert(ADDRESS_HOME_LINE2); available_field_types.insert(ADDRESS_HOME_CITY); @@ -1852,7 +1809,7 @@ TEST(FormStructureTest, CheckDataPresence) { EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" " formsignature=\"6402244543831589061\" autofillused=\"false\"" - " datapresent=\"1f7e0f8378001fc8\">" + " datapresent=\"1f7e000378001fc8\">" "<field signature=\"1089846351\" autofilltype=\"1\"/>" "<field signature=\"2404144663\" autofilltype=\"1\"/>" "<field signature=\"420638584\" autofilltype=\"1\"/>" diff --git a/chrome/browser/autofill/home_phone_number.cc b/chrome/browser/autofill/home_phone_number.cc deleted file mode 100644 index 6f4ecea..0000000 --- a/chrome/browser/autofill/home_phone_number.cc +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/autofill/home_phone_number.h" - -HomePhoneNumber::HomePhoneNumber(AutofillProfile* profile) - : PhoneNumber(profile) { -} - -HomePhoneNumber::HomePhoneNumber(const HomePhoneNumber& phone) - : PhoneNumber(phone) { -} - -HomePhoneNumber::~HomePhoneNumber() { -} - -HomePhoneNumber& HomePhoneNumber::operator=(const HomePhoneNumber& phone) { - PhoneNumber::operator=(phone); - return *this; -} - -AutofillFieldType HomePhoneNumber::GetNumberType() const { - return PHONE_HOME_NUMBER; -} - -AutofillFieldType HomePhoneNumber::GetCityCodeType() const { - return PHONE_HOME_CITY_CODE; -} - -AutofillFieldType HomePhoneNumber::GetCountryCodeType() const { - return PHONE_HOME_COUNTRY_CODE; -} - -AutofillFieldType HomePhoneNumber::GetCityAndNumberType() const { - return PHONE_HOME_CITY_AND_NUMBER; -} - -AutofillFieldType HomePhoneNumber::GetWholeNumberType() const { - return PHONE_HOME_WHOLE_NUMBER; -} diff --git a/chrome/browser/autofill/home_phone_number.h b/chrome/browser/autofill/home_phone_number.h deleted file mode 100644 index eee1162..0000000 --- a/chrome/browser/autofill/home_phone_number.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_AUTOFILL_HOME_PHONE_NUMBER_H_ -#define CHROME_BROWSER_AUTOFILL_HOME_PHONE_NUMBER_H_ -#pragma once - -#include "chrome/browser/autofill/phone_number.h" - -class FormGroup; - -class HomePhoneNumber : public PhoneNumber { - public: - explicit HomePhoneNumber(AutofillProfile* profile); - HomePhoneNumber(const HomePhoneNumber& phone); - virtual ~HomePhoneNumber(); - - HomePhoneNumber& operator=(const HomePhoneNumber& phone); - - protected: - virtual AutofillFieldType GetNumberType() const; - virtual AutofillFieldType GetCityCodeType() const; - virtual AutofillFieldType GetCountryCodeType() const; - virtual AutofillFieldType GetCityAndNumberType() const; - virtual AutofillFieldType GetWholeNumberType() const; -}; - -#endif // CHROME_BROWSER_AUTOFILL_HOME_PHONE_NUMBER_H_ diff --git a/chrome/browser/autofill/personal_data_manager.cc b/chrome/browser/autofill/personal_data_manager.cc index 648c3d4..dd8ee30 100644 --- a/chrome/browser/autofill/personal_data_manager.cc +++ b/chrome/browser/autofill/personal_data_manager.cc @@ -103,11 +103,8 @@ bool IsValidFieldTypeAndValue(const std::set<AutofillFieldType>& types_seen, // This indicates ambiguous data or miscategorization of types. // Make an exception for PHONE_HOME_NUMBER however as both prefix and // suffix are stored against this type. - if (types_seen.count(field_type) && - field_type != PHONE_HOME_NUMBER && - field_type != PHONE_FAX_NUMBER) { + if (types_seen.count(field_type) && field_type != PHONE_HOME_NUMBER) return false; - } // Abandon the import if an email address value shows up in a field that is // not an email address. @@ -217,8 +214,7 @@ bool PersonalDataManager::ImportFormData( // We only set complete phone, so aggregate phone parts in these vars and set // complete at the end. - PhoneNumber::PhoneCombineHelper home(AutofillType::PHONE_HOME); - PhoneNumber::PhoneCombineHelper fax(AutofillType::PHONE_FAX); + PhoneNumber::PhoneCombineHelper home; for (size_t i = 0; i < form.field_count(); ++i) { const AutofillField* field = form.field(i); @@ -253,9 +249,9 @@ bool PersonalDataManager::ImportFormData( } else { // We need to store phone data in the variables, before building the whole // number at the end. The rest of the fields are set "as is". - // If the fields are not the phone fields in question both home.SetInfo() - // and fax.SetInfo() are going to return false. - if (!home.SetInfo(field_type, value) && !fax.SetInfo(field_type, value)) + // If the fields are not the phone fields in question home.SetInfo() is + // going to return false. + if (!home.SetInfo(field_type, value)) imported_profile->SetCanonicalizedInfo(field_type, value); // Reject profiles with invalid country information. @@ -267,8 +263,7 @@ bool PersonalDataManager::ImportFormData( } } - // Construct the phone and fax numbers. Reject the profile if either number - // is invalid. + // Construct the phone number. Reject the profile if the number is invalid. if (imported_profile.get() && !home.IsEmpty()) { string16 constructed_number; if (!home.ParseNumber(imported_profile->CountryCode(), @@ -278,15 +273,6 @@ bool PersonalDataManager::ImportFormData( imported_profile.reset(); } } - if (imported_profile.get() && !fax.IsEmpty()) { - string16 constructed_number; - if (!fax.ParseNumber(imported_profile->CountryCode(), - &constructed_number) || - !imported_profile->SetCanonicalizedInfo(PHONE_FAX_WHOLE_NUMBER, - constructed_number)) { - imported_profile.reset(); - } - } // Reject the profile if minimum address and validation requirements are not // met. diff --git a/chrome/browser/autofill/personal_data_manager_mac.mm b/chrome/browser/autofill/personal_data_manager_mac.mm index 66d68f9..58e3fcd 100644 --- a/chrome/browser/autofill/personal_data_manager_mac.mm +++ b/chrome/browser/autofill/personal_data_manager_mac.mm @@ -91,7 +91,7 @@ void AuxiliaryProfilesImpl::GetAddressBookMeCard() { // Fill in email information. GetAddressBookEmail(me, addressLabelRaw, profile.get()); - // Fill in phone and fax number information. + // Fill in phone number information. GetAddressBookPhoneNumbers(me, addressLabelRaw, profile.get()); profiles_.push_back(profile.release()); @@ -182,7 +182,7 @@ void AuxiliaryProfilesImpl::GetAddressBookEmail( } // Fills in telephone numbers. Each of these are special cases. -// We match four cases: home/tel, home/fax, work/tel, work/fax. +// We match two cases: home/tel, work/tel. // Note, we traverse in reverse order so that top values in address book // take priority. void AuxiliaryProfilesImpl::GetAddressBookPhoneNumbers( @@ -199,21 +199,11 @@ void AuxiliaryProfilesImpl::GetAddressBookPhoneNumbers( string16 homePhone = base::SysNSStringToUTF16( [phoneNumbers valueAtIndex:reverseK]); profile->SetInfo(PHONE_HOME_WHOLE_NUMBER, homePhone); - } else if ([addressLabelRaw isEqualToString:kABAddressHomeLabel] && - [phoneLabelRaw isEqualToString:kABPhoneHomeFAXLabel]) { - string16 homeFax = base::SysNSStringToUTF16( - [phoneNumbers valueAtIndex:reverseK]); - profile->SetInfo(PHONE_FAX_WHOLE_NUMBER, homeFax); } else if ([addressLabelRaw isEqualToString:kABAddressWorkLabel] && [phoneLabelRaw isEqualToString:kABPhoneWorkLabel]) { string16 workPhone = base::SysNSStringToUTF16( [phoneNumbers valueAtIndex:reverseK]); profile->SetInfo(PHONE_HOME_WHOLE_NUMBER, workPhone); - } else if ([addressLabelRaw isEqualToString:kABAddressWorkLabel] && - [phoneLabelRaw isEqualToString:kABPhoneWorkFAXLabel]) { - string16 workFax = base::SysNSStringToUTF16( - [phoneNumbers valueAtIndex:reverseK]); - profile->SetInfo(PHONE_FAX_WHOLE_NUMBER, workFax); } else if ([phoneLabelRaw isEqualToString:kABPhoneMobileLabel] || [phoneLabelRaw isEqualToString:kABPhoneMainLabel]) { string16 phone = base::SysNSStringToUTF16( diff --git a/chrome/browser/autofill/personal_data_manager_unittest.cc b/chrome/browser/autofill/personal_data_manager_unittest.cc index ac82140..2a7d20f 100644 --- a/chrome/browser/autofill/personal_data_manager_unittest.cc +++ b/chrome/browser/autofill/personal_data_manager_unittest.cc @@ -96,7 +96,7 @@ TEST_F(PersonalDataManagerTest, AddProfile) { autofill_test::SetProfileInfo(&profile0, "John", "Mitchell", "Smith", "j@s.com", "Acme Inc.", "1 Main", "Apt A", "San Francisco", "CA", - "94102", "USA", "4158889999", "4152223333"); + "94102", "USA", "4158889999"); // Add profile0 to the database. personal_data_->AddProfile(profile0); @@ -147,19 +147,19 @@ TEST_F(PersonalDataManagerTest, AddUpdateRemoveProfiles) { autofill_test::SetProfileInfo(&profile0, "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", - "91601", "US", "12345678910", "01987654321"); + "91601", "US", "12345678910"); AutofillProfile profile1; autofill_test::SetProfileInfo(&profile1, "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "903 Apple Ct.", NULL, "Orlando", "FL", "32801", - "US", "19482937549", "13502849239"); + "US", "19482937549"); AutofillProfile profile2; autofill_test::SetProfileInfo(&profile2, "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", - "32801", "US", "19482937549", "13502849239"); + "32801", "US", "19482937549"); // Add two test profiles to the database. personal_data_->AddProfile(profile0); @@ -263,13 +263,13 @@ TEST_F(PersonalDataManagerTest, AddProfilesAndCreditCards) { autofill_test::SetProfileInfo(&profile0, "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", - "91601", "US", "12345678910", "01987654321"); + "91601", "US", "12345678910"); AutofillProfile profile1; autofill_test::SetProfileInfo(&profile1, "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "903 Apple Ct.", NULL, "Orlando", "FL", "32801", - "US", "19482937549", "13502849239"); + "US", "19482937549"); CreditCard credit_card0; autofill_test::SetCreditCardInfo(&credit_card0, @@ -322,7 +322,7 @@ TEST_F(PersonalDataManagerTest, AddProfilesAndCreditCards) { TEST_F(PersonalDataManagerTest, PopulateUniqueIDsOnLoad) { AutofillProfile profile0; autofill_test::SetProfileInfo(&profile0, - "y", "", "", "", "", "", "", "", "", "", "", "", ""); + "y", "", "", "", "", "", "", "", "", "", "", ""); // Add the profile0 to the db. personal_data_->AddProfile(profile0); @@ -340,7 +340,7 @@ TEST_F(PersonalDataManagerTest, PopulateUniqueIDsOnLoad) { // Add a new profile. AutofillProfile profile1; autofill_test::SetProfileInfo(&profile1, - "z", "", "", "", "", "", "", "", "", "", "", "", ""); + "z", "", "", "", "", "", "", "", "", "", "", ""); personal_data_->AddProfile(profile1); // Verify that the web database has been updated and the notification sent. @@ -359,7 +359,7 @@ TEST_F(PersonalDataManagerTest, PopulateUniqueIDsOnLoad) { TEST_F(PersonalDataManagerTest, SetEmptyProfile) { AutofillProfile profile0; autofill_test::SetProfileInfo(&profile0, - "", "", "", "", "", "", "", "", "", "", "", "", ""); + "", "", "", "", "", "", "", "", "", "", "", ""); // Add the empty profile to the database. personal_data_->AddProfile(profile0); @@ -400,13 +400,13 @@ TEST_F(PersonalDataManagerTest, Refresh) { autofill_test::SetProfileInfo(&profile0, "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", - "91601", "US", "12345678910", "01987654321"); + "91601", "US", "12345678910"); AutofillProfile profile1; autofill_test::SetProfileInfo(&profile1, "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "903 Apple Ct.", NULL, "Orlando", "FL", "32801", - "US", "19482937549", "13502849239"); + "US", "19482937549"); // Add the test profiles to the database. personal_data_->AddProfile(profile0); @@ -432,7 +432,7 @@ TEST_F(PersonalDataManagerTest, Refresh) { autofill_test::SetProfileInfo(&profile2, "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", - "32801", "US", "19482937549", "13502849239"); + "32801", "US", "19482937549"); // Adjust all labels. profile_pointers.push_back(&profile2); @@ -517,7 +517,7 @@ TEST_F(PersonalDataManagerTest, ImportFormData) { AutofillProfile expected; autofill_test::SetProfileInfo(&expected, "George", NULL, "Washington", "theprez@gmail.com", NULL, "21 Laussat St", NULL, - "San Francisco", "California", "94102", NULL, NULL, NULL); + "San Francisco", "California", "94102", NULL, NULL); const std::vector<AutofillProfile*>& results = personal_data_->profiles(); ASSERT_EQ(1U, results.size()); EXPECT_EQ(0, expected.Compare(*results[0])); @@ -631,7 +631,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", NULL); + "San Francisco", "California", "94102", NULL, "6505550000"); const std::vector<AutofillProfile*>& results = personal_data_->profiles(); ASSERT_EQ(1U, results.size()); EXPECT_EQ(0, expected.Compare(*results[0])); @@ -714,7 +714,7 @@ TEST_F(PersonalDataManagerTest, AggregateTwoDifferentProfiles) { AutofillProfile expected; autofill_test::SetProfileInfo(&expected, "George", NULL, "Washington", "theprez@gmail.com", NULL, "21 Laussat St", NULL, - "San Francisco", "California", "94102", NULL, NULL, NULL); + "San Francisco", "California", "94102", NULL, NULL); const std::vector<AutofillProfile*>& results1 = personal_data_->profiles(); ASSERT_EQ(1U, results1.size()); EXPECT_EQ(0, expected.Compare(*results1[0])); @@ -759,7 +759,7 @@ TEST_F(PersonalDataManagerTest, AggregateTwoDifferentProfiles) { AutofillProfile expected2; autofill_test::SetProfileInfo(&expected2, "John", NULL, "Adams", "second@gmail.com", NULL, "22 Laussat St", NULL, - "San Francisco", "California", "94102", NULL, NULL, NULL); + "San Francisco", "California", "94102", NULL, NULL); ASSERT_EQ(2U, results2.size()); EXPECT_EQ(0, expected.Compare(*results2[0])); EXPECT_EQ(0, expected2.Compare(*results2[1])); @@ -805,7 +805,7 @@ TEST_F(PersonalDataManagerTest, AggregateTwoProfilesWithMultiValue) { AutofillProfile expected; autofill_test::SetProfileInfo(&expected, "George", NULL, "Washington", "theprez@gmail.com", NULL, "21 Laussat St", NULL, - "San Francisco", "California", "94102", NULL, NULL, NULL); + "San Francisco", "California", "94102", NULL, NULL); const std::vector<AutofillProfile*>& results1 = personal_data_->profiles(); ASSERT_EQ(1U, results1.size()); EXPECT_EQ(0, expected.Compare(*results1[0])); @@ -907,8 +907,7 @@ TEST_F(PersonalDataManagerTest, AggregateSameProfileWithConflict) { AutofillProfile expected; autofill_test::SetProfileInfo(&expected, "George", NULL, "Washington", "theprez@gmail.com", NULL, "1600 Pennsylvania Avenue", - "Suite A", "San Francisco", "California", "94102", NULL, "4085556666", - NULL); + "Suite A", "San Francisco", "California", "94102", NULL, "4085556666"); const std::vector<AutofillProfile*>& results1 = personal_data_->profiles(); ASSERT_EQ(1U, results1.size()); EXPECT_EQ(0, expected.Compare(*results1[0])); @@ -1008,7 +1007,7 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInOld) { AutofillProfile expected; autofill_test::SetProfileInfo(&expected, "George", NULL, "Washington", NULL, NULL, "190 High Street", NULL, - "Philadelphia", "Pennsylvania", "19106", NULL, NULL, NULL); + "Philadelphia", "Pennsylvania", "19106", NULL, NULL); const std::vector<AutofillProfile*>& results1 = personal_data_->profiles(); ASSERT_EQ(1U, results1.size()); EXPECT_EQ(0, expected.Compare(*results1[0])); @@ -1053,7 +1052,7 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInOld) { AutofillProfile expected2; autofill_test::SetProfileInfo(&expected2, "George", NULL, "Washington", "theprez@gmail.com", NULL, "190 High Street", NULL, - "Philadelphia", "Pennsylvania", "19106", NULL, NULL, NULL); + "Philadelphia", "Pennsylvania", "19106", NULL, NULL); ASSERT_EQ(1U, results2.size()); EXPECT_EQ(0, expected2.Compare(*results2[0])); } @@ -1101,7 +1100,7 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInNew) { AutofillProfile expected; autofill_test::SetProfileInfo(&expected, "George", NULL, "Washington", "theprez@gmail.com", "Government", "190 High Street", NULL, - "Philadelphia", "Pennsylvania", "19106", NULL, NULL, NULL); + "Philadelphia", "Pennsylvania", "19106", NULL, NULL); const std::vector<AutofillProfile*>& results1 = personal_data_->profiles(); ASSERT_EQ(1U, results1.size()); EXPECT_EQ(0, expected.Compare(*results1[0])); @@ -1641,7 +1640,7 @@ TEST_F(PersonalDataManagerTest, GetNonEmptyTypes) { autofill_test::SetProfileInfo(&profile0, "Marion", NULL, "Morrison", "johnwayne@me.xyz", NULL, "123 Zoo St.", NULL, "Hollywood", "CA", - "91601", "US", "14155678910", NULL); + "91601", "US", "14155678910"); personal_data_->AddProfile(profile0); @@ -1672,13 +1671,13 @@ TEST_F(PersonalDataManagerTest, GetNonEmptyTypes) { autofill_test::SetProfileInfo(&profile1, "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "903 Apple Ct.", NULL, "Orlando", "FL", "32801", - "US", "16502937549", "14082849239"); + "US", "16502937549"); AutofillProfile profile2; autofill_test::SetProfileInfo(&profile2, "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", - "32801", "US", "16502937549", "14152849239"); + "32801", "US", "16502937549"); personal_data_->AddProfile(profile1); personal_data_->AddProfile(profile2); @@ -1689,7 +1688,7 @@ TEST_F(PersonalDataManagerTest, GetNonEmptyTypes) { MessageLoop::current()->Run(); personal_data_->GetNonEmptyTypes(&non_empty_types); - EXPECT_EQ(23U, non_empty_types.size()); + EXPECT_EQ(18U, non_empty_types.size()); EXPECT_TRUE(non_empty_types.count(NAME_FIRST)); EXPECT_TRUE(non_empty_types.count(NAME_MIDDLE)); EXPECT_TRUE(non_empty_types.count(NAME_MIDDLE_INITIAL)); @@ -1708,11 +1707,6 @@ TEST_F(PersonalDataManagerTest, GetNonEmptyTypes) { EXPECT_TRUE(non_empty_types.count(PHONE_HOME_COUNTRY_CODE)); EXPECT_TRUE(non_empty_types.count(PHONE_HOME_CITY_AND_NUMBER)); EXPECT_TRUE(non_empty_types.count(PHONE_HOME_WHOLE_NUMBER)); - EXPECT_TRUE(non_empty_types.count(PHONE_FAX_NUMBER)); - EXPECT_TRUE(non_empty_types.count(PHONE_FAX_CITY_CODE)); - EXPECT_TRUE(non_empty_types.count(PHONE_FAX_COUNTRY_CODE)); - EXPECT_TRUE(non_empty_types.count(PHONE_FAX_CITY_AND_NUMBER)); - EXPECT_TRUE(non_empty_types.count(PHONE_FAX_WHOLE_NUMBER)); // Test with credit card information also stored. CreditCard credit_card; @@ -1727,7 +1721,7 @@ TEST_F(PersonalDataManagerTest, GetNonEmptyTypes) { MessageLoop::current()->Run(); personal_data_->GetNonEmptyTypes(&non_empty_types); - EXPECT_EQ(30U, non_empty_types.size()); + EXPECT_EQ(25U, non_empty_types.size()); EXPECT_TRUE(non_empty_types.count(NAME_FIRST)); EXPECT_TRUE(non_empty_types.count(NAME_MIDDLE)); EXPECT_TRUE(non_empty_types.count(NAME_MIDDLE_INITIAL)); @@ -1746,11 +1740,6 @@ TEST_F(PersonalDataManagerTest, GetNonEmptyTypes) { EXPECT_TRUE(non_empty_types.count(PHONE_HOME_COUNTRY_CODE)); EXPECT_TRUE(non_empty_types.count(PHONE_HOME_CITY_AND_NUMBER)); EXPECT_TRUE(non_empty_types.count(PHONE_HOME_WHOLE_NUMBER)); - EXPECT_TRUE(non_empty_types.count(PHONE_FAX_NUMBER)); - EXPECT_TRUE(non_empty_types.count(PHONE_FAX_CITY_CODE)); - EXPECT_TRUE(non_empty_types.count(PHONE_FAX_COUNTRY_CODE)); - EXPECT_TRUE(non_empty_types.count(PHONE_FAX_CITY_AND_NUMBER)); - EXPECT_TRUE(non_empty_types.count(PHONE_FAX_WHOLE_NUMBER)); EXPECT_TRUE(non_empty_types.count(CREDIT_CARD_NAME)); EXPECT_TRUE(non_empty_types.count(CREDIT_CARD_NUMBER)); EXPECT_TRUE(non_empty_types.count(CREDIT_CARD_EXP_MONTH)); @@ -1803,7 +1792,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", NULL); + "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])); diff --git a/chrome/browser/autofill/phone_field.cc b/chrome/browser/autofill/phone_field.cc index 14214a1..eec4ccd 100644 --- a/chrome/browser/autofill/phone_field.cc +++ b/chrome/browser/autofill/phone_field.cc @@ -12,10 +12,20 @@ #include "chrome/browser/autofill/autofill_field.h" #include "chrome/browser/autofill/autofill_regex_constants.h" #include "chrome/browser/autofill/autofill_scanner.h" -#include "chrome/browser/autofill/fax_number.h" -#include "chrome/browser/autofill/home_phone_number.h" #include "ui/base/l10n/l10n_util.h" +namespace { + +// This string includes all area code separators, including NoText. +string16 GetAreaRegex() { + string16 area_code = UTF8ToUTF16(autofill::kAreaCodeRe); + area_code.append(ASCIIToUTF16("|")); // Regexp separator. + area_code.append(UTF8ToUTF16(autofill::kAreaCodeNotextRe)); + return area_code; +} + +} // namespace + // Phone field grammars - first matched grammar will be parsed. Grammars are // separated by { REGEX_SEPARATOR, FIELD_NONE, 0 }. Suffix and extension are // parsed separately unless they are necessary parts of the match. @@ -112,22 +122,14 @@ FormField* PhoneField::Parse(AutofillScanner* scanner) { return NULL; scoped_ptr<PhoneField> phone_field(new PhoneField); - - // Go through the phones in order HOME, FAX, attempting to match. HOME should - // be the last as it is a catch all case ("fax" and "faxarea" parsed as FAX, - // but "area" and "someotherarea" parsed as HOME, for example). - for (int i = PHONE_TYPE_MAX - 1; i >= PHONE_TYPE_FIRST; --i) { - phone_field->SetPhoneType(static_cast<PhoneField::PhoneType>(i)); - if (ParseInternal(phone_field.get(), scanner, i == HOME_PHONE)) - return phone_field.release(); - } + if (ParseInternal(phone_field.get(), scanner)) + return phone_field.release(); return NULL; } PhoneField::PhoneField() { memset(parsed_phone_fields_, 0, sizeof(parsed_phone_fields_)); - SetPhoneType(HOME_PHONE); } bool PhoneField::ClassifyField(FieldTypeMap* map) const { @@ -140,19 +142,19 @@ bool PhoneField::ClassifyField(FieldTypeMap* map) const { (parsed_phone_fields_[FIELD_SUFFIX] != NULL)) { if (parsed_phone_fields_[FIELD_COUNTRY_CODE] != NULL) { ok = ok && AddClassification(parsed_phone_fields_[FIELD_COUNTRY_CODE], - number_->GetCountryCodeType(), + PHONE_HOME_COUNTRY_CODE, map); } - AutofillFieldType field_number_type = number_->GetNumberType(); + AutofillFieldType field_number_type = PHONE_HOME_NUMBER; if (parsed_phone_fields_[FIELD_AREA_CODE] != NULL) { ok = ok && AddClassification(parsed_phone_fields_[FIELD_AREA_CODE], - number_->GetCityCodeType(), + PHONE_HOME_CITY_CODE, map); } else if (parsed_phone_fields_[FIELD_COUNTRY_CODE] != NULL) { // Only if we can find country code without city code, it means the phone // number include city code. - field_number_type = number_->GetCityAndNumberType(); + field_number_type = PHONE_HOME_CITY_AND_NUMBER; } // We tag the prefix as PHONE_HOME_NUMBER, then when filling the form // we fill only the prefix depending on the size of the input field. @@ -163,82 +165,38 @@ bool PhoneField::ClassifyField(FieldTypeMap* map) const { // we fill only the suffix depending on the size of the input field. if (parsed_phone_fields_[FIELD_SUFFIX] != NULL) { ok = ok && AddClassification(parsed_phone_fields_[FIELD_SUFFIX], - number_->GetNumberType(), + PHONE_HOME_NUMBER, map); } } else { ok = AddClassification(parsed_phone_fields_[FIELD_PHONE], - number_->GetWholeNumberType(), + PHONE_HOME_WHOLE_NUMBER, map); } return ok; } -string16 PhoneField::GetCountryRegex() const { - // This one is the same for Home and Fax numbers. - return UTF8ToUTF16(autofill::kCountryCodeRe); -} - -string16 PhoneField::GetAreaRegex() const { - // This one is the same for Home and Fax numbers. - string16 area_code = UTF8ToUTF16(autofill::kAreaCodeRe); - area_code.append(ASCIIToUTF16("|")); // Regexp separator. - area_code.append(GetAreaNoTextRegex()); - return area_code; -} - -string16 PhoneField::GetAreaNoTextRegex() const { - // This one is the same for Home and Fax numbers. - return UTF8ToUTF16(autofill::kAreaCodeNotextRe); -} - -string16 PhoneField::GetPhoneRegex() const { - if (phone_type_ == HOME_PHONE) - return UTF8ToUTF16(autofill::kPhoneRe); - else if (phone_type_ == FAX_PHONE) - return UTF8ToUTF16(autofill::kFaxRe); - else - NOTREACHED(); - return string16(); -} - -string16 PhoneField::GetPrefixSeparatorRegex() const { - // This one is the same for Home and Fax numbers. - return UTF8ToUTF16(autofill::kPhonePrefixSeparatorRe); -} - -string16 PhoneField::GetPrefixRegex() const { - // This one is the same for Home and Fax numbers. - return UTF8ToUTF16(autofill::kPhonePrefixRe); -} - -string16 PhoneField::GetSuffixSeparatorRegex() const { - // This one is the same for Home and Fax numbers. - return UTF8ToUTF16(autofill::kPhoneSuffixSeparatorRe); -} - -string16 PhoneField::GetSuffixRegex() const { - // This one is the same for Home and Fax numbers. - return UTF8ToUTF16(autofill::kPhoneSuffixRe); -} - -string16 PhoneField::GetExtensionRegex() const { - // This one is the same for Home and Fax numbers. - return UTF8ToUTF16(autofill::kPhoneExtensionRe); -} - string16 PhoneField::GetRegExp(RegexType regex_id) const { switch (regex_id) { - case REGEX_COUNTRY: return GetCountryRegex(); - case REGEX_AREA: return GetAreaRegex(); - case REGEX_AREA_NOTEXT: return GetAreaNoTextRegex(); - case REGEX_PHONE: return GetPhoneRegex(); - case REGEX_PREFIX_SEPARATOR: return GetPrefixSeparatorRegex(); - case REGEX_PREFIX: return GetPrefixRegex(); - case REGEX_SUFFIX_SEPARATOR: return GetSuffixSeparatorRegex(); - case REGEX_SUFFIX: return GetSuffixRegex(); - case REGEX_EXTENSION: return GetExtensionRegex(); + case REGEX_COUNTRY: + return UTF8ToUTF16(autofill::kCountryCodeRe); + case REGEX_AREA: + return GetAreaRegex(); + case REGEX_AREA_NOTEXT: + return UTF8ToUTF16(autofill::kAreaCodeNotextRe); + case REGEX_PHONE: + return UTF8ToUTF16(autofill::kPhoneRe); + case REGEX_PREFIX_SEPARATOR: + return UTF8ToUTF16(autofill::kPhonePrefixSeparatorRe); + case REGEX_PREFIX: + return UTF8ToUTF16(autofill::kPhonePrefixRe); + case REGEX_SUFFIX_SEPARATOR: + return UTF8ToUTF16(autofill::kPhoneSuffixSeparatorRe); + case REGEX_SUFFIX: + return UTF8ToUTF16(autofill::kPhoneSuffixRe); + case REGEX_EXTENSION: + return UTF8ToUTF16(autofill::kPhoneExtensionRe); default: NOTREACHED(); break; @@ -248,8 +206,7 @@ string16 PhoneField::GetRegExp(RegexType regex_id) const { // static bool PhoneField::ParseInternal(PhoneField *phone_field, - AutofillScanner* scanner, - bool regular_phone) { + AutofillScanner* scanner) { DCHECK(phone_field); scanner->SaveCursor(); @@ -310,27 +267,16 @@ bool PhoneField::ParseInternal(PhoneField *phone_field, // Look for a third text box. if (!phone_field->parsed_phone_fields_[FIELD_SUFFIX]) { - if (!ParseField(scanner, phone_field->GetSuffixRegex(), + if (!ParseField(scanner, UTF8ToUTF16(autofill::kPhoneSuffixRe), &phone_field->parsed_phone_fields_[FIELD_SUFFIX])) { - ParseField(scanner, phone_field->GetSuffixSeparatorRegex(), + ParseField(scanner, UTF8ToUTF16(autofill::kPhoneSuffixSeparatorRe), &phone_field->parsed_phone_fields_[FIELD_SUFFIX]); } } // Now look for an extension. - ParseField(scanner, phone_field->GetExtensionRegex(), + ParseField(scanner, UTF8ToUTF16(autofill::kPhoneExtensionRe), &phone_field->parsed_phone_fields_[FIELD_EXTENSION]); return true; } - -void PhoneField::SetPhoneType(PhoneType phone_type) { - // Field types are different as well, so we create a temporary phone number, - // to get relevant field types. - if (phone_type == HOME_PHONE) - number_.reset(new PhoneNumber(AutofillType::PHONE_HOME, NULL)); - else - number_.reset(new PhoneNumber(AutofillType::PHONE_FAX, NULL)); - phone_type_ = phone_type; -} - diff --git a/chrome/browser/autofill/phone_field.h b/chrome/browser/autofill/phone_field.h index c4f9122..0d5722e 100644 --- a/chrome/browser/autofill/phone_field.h +++ b/chrome/browser/autofill/phone_field.h @@ -37,37 +37,10 @@ class PhoneField : public FormField { FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, ThreePartPhoneNumber); FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, ThreePartPhoneNumberPrefixSuffix); FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, ThreePartPhoneNumberPrefixSuffix2); - FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, ParseOneLineFax); - FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, ParseTwoLineFax); - FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, ThreePartFaxNumberPrefixSuffix); FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, CountryAndCityAndPhoneNumber); PhoneField(); - enum PhoneType { - PHONE_TYPE_FIRST = 0, - HOME_PHONE = PHONE_TYPE_FIRST, - FAX_PHONE, - - // Must be last. - PHONE_TYPE_MAX, - }; - - // Some field names are different for phone and fax. - string16 GetCountryRegex() const; - // This string includes all area code separators, including NoText. - string16 GetAreaRegex() const; - // Separator of the area code in the case fields are formatted without - // any text indicating what fields are (e.g. field1 "(" field2 ")" field3 "-" - // field4 means Country Code, Area Code, Prefix, Suffix) - string16 GetAreaNoTextRegex() const; - string16 GetPhoneRegex() const; - string16 GetPrefixSeparatorRegex() const; - string16 GetPrefixRegex() const; - string16 GetSuffixSeparatorRegex() const; - string16 GetSuffixRegex() const; - string16 GetExtensionRegex() const; - // This is for easy description of the possible parsing paths of the phone // fields. enum RegexType { @@ -91,19 +64,8 @@ class PhoneField : public FormField { // |iter| - in/out. Form field iterator, points to the first field that is // attempted to be parsed. If parsing successful, points to the first field // after parsed fields. - // |regular_phone| - true if the parsed phone is a HOME phone, false - // otherwise. - static bool ParseInternal(PhoneField* field, - AutofillScanner* scanner, - bool regular_phone); - - void SetPhoneType(PhoneType phone_type); - - // Field types are different as well, so we create a temporary phone number, - // to get relevant field types. - scoped_ptr<PhoneNumber> number_; - PhoneType phone_type_; - + // TODO(isherman): This method doc is out of date. + static bool ParseInternal(PhoneField* field, AutofillScanner* scanner); // Parsed fields. enum PhonePart { diff --git a/chrome/browser/autofill/phone_field_unittest.cc b/chrome/browser/autofill/phone_field_unittest.cc index 9835567..4f8dbd1 100644 --- a/chrome/browser/autofill/phone_field_unittest.cc +++ b/chrome/browser/autofill/phone_field_unittest.cc @@ -197,79 +197,6 @@ TEST_F(PhoneFieldTest, ThreePartPhoneNumberPrefixSuffix2) { EXPECT_EQ(PHONE_HOME_NUMBER, field_type_map_[ASCIIToUTF16("phone3")]); } -TEST_F(PhoneFieldTest, ParseOneLineFax) { - webkit_glue::FormField field; - field.form_control_type = ASCIIToUTF16("text"); - - field.label = ASCIIToUTF16("Fax"); - field.name = ASCIIToUTF16("fax"); - list_.push_back(new AutofillField(field, ASCIIToUTF16("fax1"))); - - AutofillScanner scanner(list_.get()); - field_.reset(Parse(&scanner)); - ASSERT_NE(static_cast<PhoneField*>(NULL), field_.get()); - ASSERT_TRUE(field_->ClassifyField(&field_type_map_)); - ASSERT_TRUE( - field_type_map_.find(ASCIIToUTF16("fax1")) != field_type_map_.end()); - EXPECT_EQ(PHONE_FAX_WHOLE_NUMBER, field_type_map_[ASCIIToUTF16("fax1")]); -} - -TEST_F(PhoneFieldTest, ParseTwoLineFax) { - webkit_glue::FormField field; - field.form_control_type = ASCIIToUTF16("text"); - - field.label = ASCIIToUTF16("Area Code"); - field.name = ASCIIToUTF16("area code"); - list_.push_back(new AutofillField(field, ASCIIToUTF16("areacode1"))); - - field.label = ASCIIToUTF16("Fax"); - field.name = ASCIIToUTF16("fax"); - list_.push_back(new AutofillField(field, ASCIIToUTF16("fax2"))); - - AutofillScanner scanner(list_.get()); - field_.reset(Parse(&scanner)); - ASSERT_NE(static_cast<PhoneField*>(NULL), field_.get()); - ASSERT_TRUE(field_->ClassifyField(&field_type_map_)); - ASSERT_TRUE( - field_type_map_.find(ASCIIToUTF16("areacode1")) != field_type_map_.end()); - // It should be FAX, based on the other phone in the group. - EXPECT_EQ(PHONE_FAX_CITY_CODE, field_type_map_[ASCIIToUTF16("areacode1")]); - ASSERT_TRUE( - field_type_map_.find(ASCIIToUTF16("fax2")) != field_type_map_.end()); - EXPECT_EQ(PHONE_FAX_NUMBER, field_type_map_[ASCIIToUTF16("fax2")]); -} - -TEST_F(PhoneFieldTest, ThreePartFaxNumberPrefixSuffix) { - webkit_glue::FormField field; - field.form_control_type = ASCIIToUTF16("text"); - - field.label = ASCIIToUTF16("Fax:"); - field.name = ASCIIToUTF16("area"); - list_.push_back(new AutofillField(field, ASCIIToUTF16("areacode1"))); - - field.label = string16(); - field.name = ASCIIToUTF16("prefix"); - list_.push_back(new AutofillField(field, ASCIIToUTF16("prefix2"))); - - field.label = string16(); - field.name = ASCIIToUTF16("suffix"); - list_.push_back(new AutofillField(field, ASCIIToUTF16("suffix3"))); - - AutofillScanner scanner(list_.get()); - field_.reset(Parse(&scanner)); - ASSERT_NE(static_cast<PhoneField*>(NULL), field_.get()); - ASSERT_TRUE(field_->ClassifyField(&field_type_map_)); - ASSERT_TRUE( - field_type_map_.find(ASCIIToUTF16("areacode1")) != field_type_map_.end()); - EXPECT_EQ(PHONE_FAX_CITY_CODE, field_type_map_[ASCIIToUTF16("areacode1")]); - ASSERT_TRUE( - field_type_map_.find(ASCIIToUTF16("prefix2")) != field_type_map_.end()); - EXPECT_EQ(PHONE_FAX_NUMBER, field_type_map_[ASCIIToUTF16("prefix2")]); - ASSERT_TRUE( - field_type_map_.find(ASCIIToUTF16("suffix3")) != field_type_map_.end()); - EXPECT_EQ(PHONE_FAX_NUMBER, field_type_map_[ASCIIToUTF16("suffix3")]); -} - TEST_F(PhoneFieldTest, CountryAndCityAndPhoneNumber) { // Phone in format <country code>:3 - <city and number>:10 // The |maxlength| is considered, otherwise it's too broad. diff --git a/chrome/browser/autofill/phone_number.cc b/chrome/browser/autofill/phone_number.cc index abc107d..7b01c15 100644 --- a/chrome/browser/autofill/phone_number.cc +++ b/chrome/browser/autofill/phone_number.cc @@ -40,14 +40,7 @@ void StripPunctuation(string16* number) { } // namespace PhoneNumber::PhoneNumber(AutofillProfile* profile) - : phone_group_(AutofillType::NO_GROUP), - profile_(profile) { -} - -PhoneNumber::PhoneNumber(AutofillType::FieldTypeGroup phone_group, - AutofillProfile* profile) - : phone_group_(phone_group), - profile_(profile) { + : profile_(profile) { } PhoneNumber::PhoneNumber(const PhoneNumber& number) : FormGroup() { @@ -59,7 +52,7 @@ PhoneNumber::~PhoneNumber() {} PhoneNumber& PhoneNumber::operator=(const PhoneNumber& number) { if (this == &number) return *this; - phone_group_ = number.phone_group_; + number_ = number.number_; profile_ = number.profile_; cached_parsed_phone_ = number.cached_parsed_phone_; @@ -67,31 +60,31 @@ PhoneNumber& PhoneNumber::operator=(const PhoneNumber& number) { } void PhoneNumber::GetSupportedTypes(FieldTypeSet* supported_types) const { - supported_types->insert(GetWholeNumberType()); - supported_types->insert(GetNumberType()); - supported_types->insert(GetCityCodeType()); - supported_types->insert(GetCityAndNumberType()); - supported_types->insert(GetCountryCodeType()); + supported_types->insert(PHONE_HOME_WHOLE_NUMBER); + supported_types->insert(PHONE_HOME_NUMBER); + supported_types->insert(PHONE_HOME_CITY_CODE); + supported_types->insert(PHONE_HOME_CITY_AND_NUMBER); + supported_types->insert(PHONE_HOME_COUNTRY_CODE); } string16 PhoneNumber::GetInfo(AutofillFieldType type) const { - if (type == GetWholeNumberType()) + if (type == PHONE_HOME_WHOLE_NUMBER) return number_; UpdateCacheIfNeeded(); if (!cached_parsed_phone_.IsValidNumber()) return string16(); - if (type == GetNumberType()) + if (type == PHONE_HOME_NUMBER) return cached_parsed_phone_.GetNumber(); - if (type == GetCityCodeType()) + if (type == PHONE_HOME_CITY_CODE) return cached_parsed_phone_.GetCityCode(); - if (type == GetCountryCodeType()) + if (type == PHONE_HOME_COUNTRY_CODE) return cached_parsed_phone_.GetCountryCode(); - if (type == GetCityAndNumberType()) { + if (type == PHONE_HOME_CITY_AND_NUMBER) { string16 city_and_local(cached_parsed_phone_.GetCityCode()); city_and_local.append(cached_parsed_phone_.GetNumber()); return city_and_local; @@ -101,10 +94,6 @@ string16 PhoneNumber::GetInfo(AutofillFieldType type) const { } void PhoneNumber::SetInfo(AutofillFieldType type, const string16& value) { - // Store the group the first time we set some info. - if (phone_group_ == AutofillType::NO_GROUP) - phone_group_ = AutofillType(type).group(); - FieldTypeSubGroup subgroup = AutofillType(type).subgroup(); if (subgroup != AutofillType::PHONE_CITY_AND_NUMBER && subgroup != AutofillType::PHONE_WHOLE_NUMBER) { @@ -123,7 +112,7 @@ void PhoneNumber::SetInfo(AutofillFieldType type, const string16& value) { // If the phone cannot be normalized, returns the stored value verbatim. string16 PhoneNumber::GetCanonicalizedInfo(AutofillFieldType type) const { string16 phone = GetInfo(type); - if (type != GetWholeNumberType()) + if (type != PHONE_HOME_WHOLE_NUMBER) return phone; string16 normalized_phone = autofill_i18n::NormalizePhoneNumber(phone, @@ -150,19 +139,19 @@ void PhoneNumber::GetMatchingTypes(const string16& text, FormGroup::GetMatchingTypes(stripped_text, matching_types); // For US numbers, also compare to the three-digit prefix and the four-digit - // suffix, since websites often split numbers into these two fields. - string16 number = GetCanonicalizedInfo(GetNumberType()); + // suffix, since web sites often split numbers into these two fields. + string16 number = GetCanonicalizedInfo(PHONE_HOME_NUMBER); if (locale() == "US" && number.size() == (kPrefixLength + kSuffixLength)) { string16 prefix = number.substr(kPrefixOffset, kPrefixLength); string16 suffix = number.substr(kSuffixOffset, kSuffixLength); if (text == prefix || text == suffix) - matching_types->insert(GetNumberType()); + matching_types->insert(PHONE_HOME_NUMBER); } - string16 whole_number = GetCanonicalizedInfo(GetWholeNumberType()); + string16 whole_number = GetCanonicalizedInfo(PHONE_HOME_WHOLE_NUMBER); if (!whole_number.empty() && autofill_i18n::NormalizePhoneNumber(text, locale()) == whole_number) { - matching_types->insert(GetWholeNumberType()); + matching_types->insert(PHONE_HOME_WHOLE_NUMBER); } } @@ -190,59 +179,7 @@ void PhoneNumber::UpdateCacheIfNeeded() const { cached_parsed_phone_ = autofill_i18n::PhoneObject(number_, locale()); } -AutofillFieldType PhoneNumber::GetNumberType() const { - if (phone_group_ == AutofillType::PHONE_HOME) - return PHONE_HOME_NUMBER; - else if (phone_group_ == AutofillType::PHONE_FAX) - return PHONE_FAX_NUMBER; - else - NOTREACHED(); - return UNKNOWN_TYPE; -} - -AutofillFieldType PhoneNumber::GetCityCodeType() const { - if (phone_group_ == AutofillType::PHONE_HOME) - return PHONE_HOME_CITY_CODE; - else if (phone_group_ == AutofillType::PHONE_FAX) - return PHONE_FAX_CITY_CODE; - else - NOTREACHED(); - return UNKNOWN_TYPE; -} - -AutofillFieldType PhoneNumber::GetCountryCodeType() const { - if (phone_group_ == AutofillType::PHONE_HOME) - return PHONE_HOME_COUNTRY_CODE; - else if (phone_group_ == AutofillType::PHONE_FAX) - return PHONE_FAX_COUNTRY_CODE; - else - NOTREACHED(); - return UNKNOWN_TYPE; -} - -AutofillFieldType PhoneNumber::GetCityAndNumberType() const { - if (phone_group_ == AutofillType::PHONE_HOME) - return PHONE_HOME_CITY_AND_NUMBER; - else if (phone_group_ == AutofillType::PHONE_FAX) - return PHONE_FAX_CITY_AND_NUMBER; - else - NOTREACHED(); - return UNKNOWN_TYPE; -} - -AutofillFieldType PhoneNumber::GetWholeNumberType() const { - if (phone_group_ == AutofillType::PHONE_HOME) - return PHONE_HOME_WHOLE_NUMBER; - else if (phone_group_ == AutofillType::PHONE_FAX) - return PHONE_FAX_WHOLE_NUMBER; - else - NOTREACHED(); - return UNKNOWN_TYPE; -} - -PhoneNumber::PhoneCombineHelper::PhoneCombineHelper( - AutofillType::FieldTypeGroup phone_group) - : phone_group_(phone_group) { +PhoneNumber::PhoneCombineHelper::PhoneCombineHelper() { } PhoneNumber::PhoneCombineHelper::~PhoneCombineHelper() { @@ -250,29 +187,27 @@ PhoneNumber::PhoneCombineHelper::~PhoneCombineHelper() { bool PhoneNumber::PhoneCombineHelper::SetInfo(AutofillFieldType field_type, const string16& value) { - PhoneNumber temp(phone_group_, NULL); - - if (field_type == temp.GetCountryCodeType()) { + if (field_type == PHONE_HOME_COUNTRY_CODE) { country_ = value; return true; } - if (field_type == temp.GetCityCodeType()) { + if (field_type == PHONE_HOME_CITY_CODE) { city_ = value; return true; } - if (field_type == temp.GetCityAndNumberType()) { + if (field_type == PHONE_HOME_CITY_AND_NUMBER) { phone_ = value; return true; } - if (field_type == temp.GetWholeNumberType()) { + if (field_type == PHONE_HOME_WHOLE_NUMBER) { whole_number_ = value; return true; } - if (field_type == temp.GetNumberType()) { + if (field_type == PHONE_HOME_NUMBER) { phone_.append(value); return true; } diff --git a/chrome/browser/autofill/phone_number.h b/chrome/browser/autofill/phone_number.h index 652cb70..7b6f876 100644 --- a/chrome/browser/autofill/phone_number.h +++ b/chrome/browser/autofill/phone_number.h @@ -21,11 +21,6 @@ class AutofillProfile; class PhoneNumber : public FormGroup { public: explicit PhoneNumber(AutofillProfile* profile); - // The |profile| can be NULL; but if so, clients should avoid calling - // |GetInfo()| or |SetInfo()|. This is typically only useful if you want to - // call into the |GetNumberType()| (etc.) functions. - PhoneNumber(AutofillType::FieldTypeGroup phone_group, - AutofillProfile* profile); PhoneNumber(const PhoneNumber& number); virtual ~PhoneNumber(); @@ -48,18 +43,10 @@ class PhoneNumber : public FormGroup { static const size_t kSuffixOffset = 3; static const size_t kSuffixLength = 4; - // The following functions should return the field type for each part of the - // phone number. Currently, these are either fax or home phone number types. - AutofillFieldType GetNumberType() const; - AutofillFieldType GetCityCodeType() const; - AutofillFieldType GetCountryCodeType() const; - AutofillFieldType GetCityAndNumberType() const; - AutofillFieldType GetWholeNumberType() const; - - // The class used to combine home phone or fax parts into a whole number. + // The class used to combine home phone parts into a whole number. class PhoneCombineHelper { public: - explicit PhoneCombineHelper(AutofillType::FieldTypeGroup phone_group); + PhoneCombineHelper(); ~PhoneCombineHelper(); // If |type| is a phone field type, saves the |value| accordingly and @@ -77,7 +64,6 @@ class PhoneNumber : public FormGroup { string16 city_; string16 phone_; string16 whole_number_; - AutofillType::FieldTypeGroup phone_group_; }; private: @@ -96,8 +82,6 @@ class PhoneNumber : public FormGroup { // since the last time the cache was updated. void UpdateCacheIfNeeded() const; - // Phone group - currently it is PHONE_HOME and PHONE_FAX. - AutofillType::FieldTypeGroup phone_group_; // The phone number. string16 number_; // Profile which stores the locale used as hint when normalizing the number. diff --git a/chrome/browser/autofill/phone_number_unittest.cc b/chrome/browser/autofill/phone_number_unittest.cc index 9a06418..9c0dd4e 100644 --- a/chrome/browser/autofill/phone_number_unittest.cc +++ b/chrome/browser/autofill/phone_number_unittest.cc @@ -14,7 +14,7 @@ TEST(PhoneNumberTest, Matcher) { profile.SetCountryCode("US"); // Set phone number so country_code == 1, city_code = 650, number = 2345678. string16 phone(ASCIIToUTF16("1 [650] 234-5678")); - PhoneNumber phone_number(AutofillType::PHONE_HOME, &profile); + PhoneNumber phone_number(&profile); phone_number.SetInfo(PHONE_HOME_WHOLE_NUMBER, phone); phone_number.NormalizePhone(); @@ -75,32 +75,12 @@ TEST(PhoneNumberTest, Matcher) { EXPECT_EQ(1U, matching_types.size()); EXPECT_TRUE(matching_types.find(PHONE_HOME_CITY_AND_NUMBER) != matching_types.end()); - - string16 fax(ASCIIToUTF16("+1(650)650-5678")); - PhoneNumber fax_number(&profile); - fax_number.SetInfo(PHONE_FAX_WHOLE_NUMBER, fax); - - matching_types.clear(); - fax_number.GetMatchingTypes(ASCIIToUTF16("16506505678"), &matching_types); - EXPECT_EQ(1U, matching_types.size()); - EXPECT_TRUE(matching_types.find(PHONE_FAX_WHOLE_NUMBER) != - matching_types.end()); - - matching_types.clear(); - fax_number.GetMatchingTypes(ASCIIToUTF16("650"), &matching_types); - EXPECT_EQ(2U, matching_types.size()); - EXPECT_TRUE(matching_types.find(PHONE_FAX_CITY_CODE) != - matching_types.end()); - EXPECT_TRUE(matching_types.find(PHONE_FAX_NUMBER) != - matching_types.end()); } TEST(PhoneNumberTest, PhoneCombineHelper) { - PhoneNumber::PhoneCombineHelper number1(AutofillType::PHONE_HOME); + PhoneNumber::PhoneCombineHelper number1; EXPECT_FALSE(number1.SetInfo(ADDRESS_BILLING_CITY, ASCIIToUTF16("1"))); - EXPECT_FALSE(number1.SetInfo(PHONE_FAX_COUNTRY_CODE, - ASCIIToUTF16("1"))); EXPECT_TRUE(number1.SetInfo(PHONE_HOME_COUNTRY_CODE, ASCIIToUTF16("1"))); EXPECT_TRUE(number1.SetInfo(PHONE_HOME_CITY_CODE, @@ -112,20 +92,7 @@ TEST(PhoneNumberTest, PhoneCombineHelper) { // International format as it has a country code. EXPECT_EQ(ASCIIToUTF16("+1 650-234-5678"), parsed_phone); - PhoneNumber::PhoneCombineHelper number2(AutofillType::PHONE_FAX); - EXPECT_FALSE(number2.SetInfo(PHONE_HOME_COUNTRY_CODE, - ASCIIToUTF16("1"))); - EXPECT_TRUE(number2.SetInfo(PHONE_FAX_COUNTRY_CODE, - ASCIIToUTF16("1"))); - EXPECT_TRUE(number2.SetInfo(PHONE_FAX_CITY_CODE, - ASCIIToUTF16("650"))); - EXPECT_TRUE(number2.SetInfo(PHONE_FAX_NUMBER, - ASCIIToUTF16("2345679"))); - EXPECT_TRUE(number2.ParseNumber("US", &parsed_phone)); - // International format as it has a country code. - EXPECT_EQ(ASCIIToUTF16("+1 650-234-5679"), parsed_phone); - - PhoneNumber::PhoneCombineHelper number3(AutofillType::PHONE_HOME); + PhoneNumber::PhoneCombineHelper number3; EXPECT_TRUE(number3.SetInfo(PHONE_HOME_CITY_CODE, ASCIIToUTF16("650"))); EXPECT_TRUE(number3.SetInfo(PHONE_HOME_NUMBER, @@ -134,7 +101,7 @@ TEST(PhoneNumberTest, PhoneCombineHelper) { // National format as it does not have a country code. EXPECT_EQ(ASCIIToUTF16("(650) 234-5680"), parsed_phone); - PhoneNumber::PhoneCombineHelper number4(AutofillType::PHONE_HOME); + PhoneNumber::PhoneCombineHelper number4; EXPECT_TRUE(number4.SetInfo(PHONE_HOME_CITY_CODE, ASCIIToUTF16("123"))); // Incorrect city code. EXPECT_TRUE(number4.SetInfo(PHONE_HOME_NUMBER, @@ -142,13 +109,13 @@ TEST(PhoneNumberTest, PhoneCombineHelper) { EXPECT_FALSE(number4.ParseNumber("US", &parsed_phone)); EXPECT_EQ(string16(), parsed_phone); - PhoneNumber::PhoneCombineHelper number5(AutofillType::PHONE_HOME); + PhoneNumber::PhoneCombineHelper number5; EXPECT_TRUE(number5.SetInfo(PHONE_HOME_CITY_AND_NUMBER, ASCIIToUTF16("6502345681"))); EXPECT_TRUE(number5.ParseNumber("US", &parsed_phone)); EXPECT_EQ(ASCIIToUTF16("(650) 234-5681"), parsed_phone); - PhoneNumber::PhoneCombineHelper number6(AutofillType::PHONE_HOME); + PhoneNumber::PhoneCombineHelper number6; EXPECT_TRUE(number6.SetInfo(PHONE_HOME_CITY_CODE, ASCIIToUTF16("650"))); EXPECT_TRUE(number6.SetInfo(PHONE_HOME_NUMBER, diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index b60f01c..71f1eac 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -5068,9 +5068,6 @@ std::map<AutofillFieldType, std::string> autofill_type_to_string[PHONE_HOME_CITY_CODE] = "PHONE_HOME_CITY_CODE"; autofill_type_to_string[PHONE_HOME_WHOLE_NUMBER] = "PHONE_HOME_WHOLE_NUMBER"; - autofill_type_to_string[PHONE_FAX_COUNTRY_CODE] = "PHONE_FAX_COUNTRY_CODE"; - autofill_type_to_string[PHONE_FAX_CITY_CODE] = "PHONE_FAX_CITY_CODE"; - autofill_type_to_string[PHONE_FAX_WHOLE_NUMBER] = "PHONE_FAX_WHOLE_NUMBER"; return autofill_type_to_string; } diff --git a/chrome/browser/resources/options/autofill_edit_address_overlay.html b/chrome/browser/resources/options/autofill_edit_address_overlay.html index e4ad619..9caddb0 100644 --- a/chrome/browser/resources/options/autofill_edit_address_overlay.html +++ b/chrome/browser/resources/options/autofill_edit_address_overlay.html @@ -67,23 +67,15 @@ <span i18n-content="phoneLabel"></span> </label> </div> - <div class="input cell"> - <label for="fax-list"> - <span i18n-content="faxLabel"></span> - </label> - </div> </div> <div class="row"> <div class="input cell"> <list id="phone-list" i18n-values="placeholder:addNewPhonePlaceholder"></list> </div> - <div class="input cell"> - <list id="fax-list" - i18n-values="placeholder:addNewFaxPlaceholder"></list> - </div> </div> </div> + <!-- TODO(jhawkins): Move email next to phone in the UI. --> <div class="table"> <div class="row"> <div class="input cell"> diff --git a/chrome/browser/resources/options/autofill_edit_address_overlay.js b/chrome/browser/resources/options/autofill_edit_address_overlay.js index 2994d77..2cb1b63 100644 --- a/chrome/browser/resources/options/autofill_edit_address_overlay.js +++ b/chrome/browser/resources/options/autofill_edit_address_overlay.js @@ -50,7 +50,7 @@ cr.define('options', function() { /** * Creates, decorates and initializes the multi-value lists for full name, - * phone, fax, and email. + * phone, and email. * @private */ createMultiValueLists_: function() { @@ -62,10 +62,6 @@ cr.define('options', function() { options.autofillOptions.AutofillPhoneValuesList.decorate(list); list.autoExpands = true; - list = $('fax-list'); - options.autofillOptions.AutofillFaxValuesList.decorate(list); - list.autoExpands = true; - list = $('email-list'); options.autofillOptions.AutofillValuesList.decorate(list); list.autoExpands = true; @@ -123,10 +119,8 @@ cr.define('options', function() { address[8] = $('country').value; list = $('phone-list'); address[9] = list.dataModel.slice(0, list.dataModel.length - 1); - list = $('fax-list'); - address[10] = list.dataModel.slice(0, list.dataModel.length - 1); list = $('email-list'); - address[11] = list.dataModel.slice(0, list.dataModel.length - 1); + address[10] = list.dataModel.slice(0, list.dataModel.length - 1); chrome.send('setAddress', address); }, @@ -164,7 +158,7 @@ cr.define('options', function() { !$('addr-line-1').value && !$('addr-line-2').value && !$('city').value && !$('state').value && !$('postal-code').value && !$('country').value && $('phone-list').items.length <= 1 && - $('fax-list').items.length <= 1 && $('email-list').items.length <= 1; + $('email-list').items.length <= 1; $('autofill-edit-address-apply-button').disabled = disabled; }, @@ -248,7 +242,6 @@ cr.define('options', function() { $('postal-code').value = ''; $('country').value = ''; this.setMultiValueList_('phone-list', []); - this.setMultiValueList_('fax-list', []); this.setMultiValueList_('email-list', []); this.countryChanged_(); @@ -279,7 +272,6 @@ cr.define('options', function() { $('postal-code').value = address['postalCode']; $('country').value = address['country']; this.setMultiValueList_('phone-list', address['phone']); - this.setMultiValueList_('fax-list', address['fax']); this.setMultiValueList_('email-list', address['email']); this.countryChanged_(); @@ -303,11 +295,6 @@ cr.define('options', function() { numbers); }; - AutofillEditAddressOverlay.setValidatedFaxNumbers = function(numbers) { - AutofillEditAddressOverlay.getInstance().setMultiValueList_('fax-list', - numbers); - }; - // Export return { AutofillEditAddressOverlay: AutofillEditAddressOverlay diff --git a/chrome/browser/resources/options/autofill_options_list.js b/chrome/browser/resources/options/autofill_options_list.js index dd80600..e89b6b5 100644 --- a/chrome/browser/resources/options/autofill_options_list.js +++ b/chrome/browser/resources/options/autofill_options_list.js @@ -366,32 +366,6 @@ cr.define('options.autofillOptions', function() { }, }; - /** - * Create a new value list for fax number validation. - * @constructor - * @extends {options.AutofillValuesList} - */ - var AutofillFaxValuesList = cr.ui.define('list'); - - AutofillFaxValuesList.prototype = { - __proto__: AutofillValuesList.prototype, - - decorate: function() { - AutofillValuesList.prototype.decorate.call(this); - }, - - /** @inheritDoc */ - validateAndSave: function(index, remove, value) { - var numbers = this.dataModel.slice(0, this.dataModel.length - 1); - numbers.splice(index, remove, value); - var info = new Array(); - info[0] = index; - info[1] = numbers; - info[2] = $('country').value; - chrome.send('validateFaxNumbers', info); - }, - }; - return { AddressListItem: AddressListItem, CreditCardListItem: CreditCardListItem, @@ -401,6 +375,5 @@ cr.define('options.autofillOptions', function() { AutofillCreditCardList: AutofillCreditCardList, AutofillValuesList: AutofillValuesList, AutofillPhoneValuesList: AutofillPhoneValuesList, - AutofillFaxValuesList: AutofillFaxValuesList, }; }); diff --git a/chrome/browser/sync/glue/autofill_model_associator.cc b/chrome/browser/sync/glue/autofill_model_associator.cc index a66b219..d941bd7 100644 --- a/chrome/browser/sync/glue/autofill_model_associator.cc +++ b/chrome/browser/sync/glue/autofill_model_associator.cc @@ -506,8 +506,6 @@ bool AutofillModelAssociator::FillProfileWithServerData( diff = MergeField(p, ADDRESS_HOME_ZIP, s.address_home_zip()) || diff; diff = MergeField(p, EMAIL_ADDRESS, s.email_address()) || diff; diff = MergeField(p, COMPANY_NAME, s.company_name()) || diff; - diff = MergeField(p, PHONE_FAX_WHOLE_NUMBER, s.phone_fax_whole_number()) - || diff; diff = MergeField(p, PHONE_HOME_WHOLE_NUMBER, s.phone_home_whole_number()) || diff; return diff; diff --git a/chrome/browser/sync/glue/autofill_profile_syncable_service.cc b/chrome/browser/sync/glue/autofill_profile_syncable_service.cc index 5737fe3..1296543 100644 --- a/chrome/browser/sync/glue/autofill_profile_syncable_service.cc +++ b/chrome/browser/sync/glue/autofill_profile_syncable_service.cc @@ -263,8 +263,6 @@ bool AutofillProfileSyncableService::OverwriteProfileWithServerData( specifics.address_home_zip()) || diff; diff = MergeField(profile, EMAIL_ADDRESS, specifics.email_address()) || diff; diff = MergeField(profile, COMPANY_NAME, specifics.company_name()) || diff; - diff = MergeField(profile, PHONE_FAX_WHOLE_NUMBER, - specifics.phone_fax_whole_number()) || diff; diff = MergeField(profile, PHONE_HOME_WHOLE_NUMBER, specifics.phone_home_whole_number()) || diff; return diff; @@ -297,8 +295,6 @@ void AutofillProfileSyncableService::WriteAutofillProfile( ADDRESS_HOME_ZIP))); specifics->set_email_address(UTF16ToUTF8(profile.GetInfo(EMAIL_ADDRESS))); specifics->set_company_name(UTF16ToUTF8(profile.GetInfo(COMPANY_NAME))); - specifics->set_phone_fax_whole_number(UTF16ToUTF8(profile.GetInfo( - PHONE_FAX_WHOLE_NUMBER))); specifics->set_phone_home_whole_number(UTF16ToUTF8(profile.GetInfo( PHONE_HOME_WHOLE_NUMBER))); } diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc index e2ef664..c886e47 100644 --- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc @@ -680,7 +680,7 @@ TEST_F(ProfileSyncServiceAutofillTest, HasProfileEmptySync) { "54B3F9AA-335E-4F71-A27D-719C41564230", "Billing", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", - "91601", "US", "12345678910", "01987654321"); + "91601", "US", "12345678910"); profiles.push_back(profile0); expected_profiles.push_back(*profile0); EXPECT_CALL(autofill_table_, GetAutofillProfiles(_)). @@ -790,13 +790,13 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncMergeProfile) { "23355099-1170-4B71-8ED4-144470CC9EBE", "Billing", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", - "91601", "US", "12345678910", "01987654321"); + "91601", "US", "12345678910"); AutofillProfile* native_profile = new AutofillProfile; autofill_test::SetProfileInfoWithGuid(native_profile, "23355099-1170-4B71-8ED4-144470CC9EBE", "Billing", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", - "32801", "US", "19482937549", "13502849239"); + "32801", "US", "19482937549"); std::vector<AutofillProfile*> native_profiles; native_profiles.push_back(native_profile); @@ -827,7 +827,7 @@ TEST_F(ProfileSyncServiceAutofillTest, MergeProfileWithDifferentGuid) { "23355099-1170-4B71-8ED4-144470CC9EBE", "Billing", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", - "91601", "US", "12345678910", "01987654321"); + "91601", "US", "12345678910"); std::string native_guid = "EDC609ED-7EEE-4F27-B00C-423242A9C44B"; AutofillProfile* native_profile = new AutofillProfile; @@ -835,7 +835,7 @@ TEST_F(ProfileSyncServiceAutofillTest, MergeProfileWithDifferentGuid) { native_guid.c_str(), "Billing", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", - "91601", "US", "12345678910", "01987654321"); + "91601", "US", "12345678910"); std::vector<AutofillProfile*> native_profiles; native_profiles.push_back(native_profile); @@ -904,7 +904,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddProfile) { autofill_test::SetProfileInfoWithGuid(&added_profile, "D6ADA912-D374-4C0A-917D-F5C8EBE43011", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", - "32801", "US", "19482937549", "13502849239"); + "32801", "US", "19482937549"); AutofillProfileChange change(AutofillProfileChange::ADD, added_profile.guid(), &added_profile); @@ -989,12 +989,12 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveProfile) { autofill_test::SetProfileInfoWithGuid(&sync_profile, "3BA5FA1B-1EC4-4BB3-9B57-EC92BE3C1A09", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", - "32801", "US", "19482937549", "13502849239"); + "32801", "US", "19482937549"); AutofillProfile* native_profile = new AutofillProfile; autofill_test::SetProfileInfoWithGuid(native_profile, "3BA5FA1B-1EC4-4BB3-9B57-EC92BE3C1A09", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", - "32801", "US", "19482937549", "13502849239"); + "32801", "US", "19482937549"); std::vector<AutofillProfile*> native_profiles; native_profiles.push_back(native_profile); diff --git a/chrome/browser/sync/protocol/autofill_specifics.proto b/chrome/browser/sync/protocol/autofill_specifics.proto index 907fca4..d9026b1 100644 --- a/chrome/browser/sync/protocol/autofill_specifics.proto +++ b/chrome/browser/sync/protocol/autofill_specifics.proto @@ -40,8 +40,11 @@ message AutofillProfileSpecifics { optional string address_home_zip = 11; optional string address_home_country = 12; - // Phone + fax. + // Phone. optional string phone_home_whole_number = 13; + + // Deprecated. + // TODO(jhawkins): Determine if this is safe to remove. optional string phone_fax_whole_number = 14; } diff --git a/chrome/browser/sync/test/integration/autofill_helper.cc b/chrome/browser/sync/test/integration/autofill_helper.cc index 4227e24..7ca0a97 100644 --- a/chrome/browser/sync/test/integration/autofill_helper.cc +++ b/chrome/browser/sync/test/integration/autofill_helper.cc @@ -96,7 +96,7 @@ AutofillProfile CreateAutofillProfile(ProfileType type) { "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", - "91601", "US", "12345678910", "01987654321"); + "91601", "US", "12345678910"); break; case PROFILE_HOMER: autofill_test::SetProfileInfoWithGuid(&profile, @@ -104,19 +104,19 @@ AutofillProfile CreateAutofillProfile(ProfileType type) { "Homer", "J.", "Simpson", "homer@abc.com", "SNPP", "1 Main St", "PO Box 1", "Springfield", "MA", - "94101", "US", "14155551212", "14155551313"); + "94101", "US", "14155551212"); break; case PROFILE_FRASIER: autofill_test::SetProfileInfoWithGuid(&profile, "9A5E6872-6198-4688-BF75-0016E781BB0A", "Frasier", "Winslow", "Crane", "", "randomness", "", "Apt. 4", "Seattle", "WA", - "99121", "US", "0000000000", "ABCDEFGHIJK"); + "99121", "US", "0000000000"); break; case PROFILE_NULL: autofill_test::SetProfileInfoWithGuid(&profile, "FE461507-7E13-4198-8E66-74C7DB6D8322", - "", "", "", "", "", "", "", "", "", "", "", "", ""); + "", "", "", "", "", "", "", "", "", "", "", ""); break; } return profile; diff --git a/chrome/browser/sync/test/integration/performance/autofill_sync_perf_test.cc b/chrome/browser/sync/test/integration/performance/autofill_sync_perf_test.cc index 6deb9c7..65b1717 100644 --- a/chrome/browser/sync/test/integration/performance/autofill_sync_perf_test.cc +++ b/chrome/browser/sync/test/integration/performance/autofill_sync_perf_test.cc @@ -127,7 +127,7 @@ const AutofillProfile AutofillSyncPerfTest::NextAutofillProfile() { AutofillProfile profile; autofill_test::SetProfileInfoWithGuid(&profile, NextGUID().c_str(), NextName().c_str(), "", "", "", "", "", - "", "", "", "", "", "", ""); + "", "", "", "", "", ""); return profile; } diff --git a/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc b/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc index 7c26741..e450c18 100644 --- a/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc @@ -188,7 +188,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, SameProfileWithConflict) { AutofillProfile profile0 = CreateAutofillProfile(PROFILE_HOMER); AutofillProfile profile1 = CreateAutofillProfile(PROFILE_HOMER); - profile1.SetInfo(PHONE_FAX_WHOLE_NUMBER, ASCIIToUTF16("1234567890")); + profile1.SetInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("1234567890")); AddProfile(0, profile0); AddProfile(1, profile1); diff --git a/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc b/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc index 3e3c8b1..c3f8dd0 100644 --- a/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc +++ b/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc @@ -222,7 +222,6 @@ IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, "", "66183", "\xD7\x99\xD7\xA9\xD7\xA8\xD7\x90\xD7\x9C", - "0000", "0000"); PersonalDataManager* personal_data_manager = @@ -254,8 +253,7 @@ IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, "Texas", "78744", "United States", - "5125551234", - "5125550000"); + "5125551234"); PersonalDataManager* personal_data_manager = browser()->profile()->GetPersonalDataManager(); diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.cc b/chrome/browser/ui/webui/options/autofill_options_handler.cc index 3a9b3e0..724255a 100644 --- a/chrome/browser/ui/webui/options/autofill_options_handler.cc +++ b/chrome/browser/ui/webui/options/autofill_options_handler.cc @@ -117,8 +117,8 @@ void SetValueList(const ListValue* list, profile->SetMultiInfo(type, values); } -// Pulls the phone (or fax) number |index|, |phone_number_list|, and -// |country_code| from the |args| input. +// Pulls the phone number |index|, |phone_number_list|, and |country_code| from +// the |args| input. void ExtractPhoneNumberInformation(const ListValue* args, size_t* index, ListValue** phone_number_list, @@ -253,9 +253,6 @@ void AutofillOptionsHandler::RegisterMessages() { web_ui_->RegisterMessageCallback( "validatePhoneNumbers", NewCallback(this, &AutofillOptionsHandler::ValidatePhoneNumbers)); - web_ui_->RegisterMessageCallback( - "validateFaxNumbers", - NewCallback(this, &AutofillOptionsHandler::ValidateFaxNumbers)); } ///////////////////////////////////////////////////////////////////////////// @@ -282,16 +279,12 @@ void AutofillOptionsHandler::SetAddressOverlayStrings( l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_COUNTRY)); localized_strings->SetString("phoneLabel", l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PHONE)); - localized_strings->SetString("faxLabel", - l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_FAX)); localized_strings->SetString("emailLabel", l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_EMAIL)); localized_strings->SetString("addNewNamePlaceholder", l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_NEW_NAME)); localized_strings->SetString("addNewPhonePlaceholder", l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_NEW_PHONE)); - localized_strings->SetString("addNewFaxPlaceholder", - l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_NEW_FAX)); localized_strings->SetString("addNewEmailPlaceholder", l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_NEW_EMAIL)); @@ -405,8 +398,6 @@ void AutofillOptionsHandler::LoadAddressEditor(const ListValue* args) { address.SetString("country", profile->CountryCode()); GetValueList(*profile, PHONE_HOME_WHOLE_NUMBER, &list); address.Set("phone", list.release()); - GetValueList(*profile, PHONE_FAX_WHOLE_NUMBER, &list); - address.Set("fax", list.release()); GetValueList(*profile, EMAIL_ADDRESS, &list); address.Set("email", list.release()); @@ -482,8 +473,6 @@ void AutofillOptionsHandler::SetAddress(const ListValue* args) { if (args->GetList(9, &list_value)) SetValueList(list_value, PHONE_HOME_WHOLE_NUMBER, &profile); if (args->GetList(10, &list_value)) - SetValueList(list_value, PHONE_FAX_WHOLE_NUMBER, &profile); - if (args->GetList(11, &list_value)) SetValueList(list_value, EMAIL_ADDRESS, &profile); if (!guid::IsValidGUID(profile.guid())) { @@ -534,14 +523,3 @@ void AutofillOptionsHandler::ValidatePhoneNumbers(const ListValue* args) { web_ui_->CallJavascriptFunction( "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); } - -void AutofillOptionsHandler::ValidateFaxNumbers(const ListValue* args) { - if (!personal_data_->IsDataLoaded()) - return; - - ListValue* list_value = NULL; - ValidatePhoneArguments(args, &list_value); - - web_ui_->CallJavascriptFunction( - "AutofillEditAddressOverlay.setValidatedFaxNumbers", *list_value); -} diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.h b/chrome/browser/ui/webui/options/autofill_options_handler.h index 1e8fe07..4af29b8 100644 --- a/chrome/browser/ui/webui/options/autofill_options_handler.h +++ b/chrome/browser/ui/webui/options/autofill_options_handler.h @@ -72,12 +72,11 @@ class AutofillOptionsHandler : public OptionsPageUIHandler, // credit card data. void SetCreditCard(const base::ListValue* args); - // Validates a list of phone/fax numbers. The resulting validated list of + // Validates a list of phone numbers. The resulting validated list of // numbers is then sent back to the WebUI. // |args| - an array containing the index of the modified or added number, the // array of numbers, and the country code string set on the profile. void ValidatePhoneNumbers(const base::ListValue* args); - void ValidateFaxNumbers(const base::ListValue* args); // The personal data manager, used to load Autofill profiles and credit cards. // Unowned pointer, may not be NULL. diff --git a/chrome/browser/webdata/autofill_table.cc b/chrome/browser/webdata/autofill_table.cc index 0d0591d..fd152e1 100644 --- a/chrome/browser/webdata/autofill_table.cc +++ b/chrome/browser/webdata/autofill_table.cc @@ -33,12 +33,6 @@ using webkit_glue::FormField; namespace { -// Constants for the |autofill_profile_phones| |type| column. -enum AutofillPhoneType { - kAutofillPhoneNumber = 0, - kAutofillFaxNumber = 1 -}; - typedef std::vector<Tuple3<int64, string16, string16> > AutofillElementList; // TODO(dhollowa): Find a common place for this. It is duplicated in @@ -201,7 +195,8 @@ bool AddAutofillProfilePhonesToProfile(sql::Connection* db, return false; } s.BindString(0, profile->guid()); - s.BindInt(1, kAutofillPhoneNumber); + // Value used to be either [(0, phone), (1, fax)] but fax has been removed. + s.BindInt(1, 0); std::vector<string16> numbers; while (s.Step()) { @@ -212,29 +207,6 @@ bool AddAutofillProfilePhonesToProfile(sql::Connection* db, return true; } -bool AddAutofillProfileFaxesToProfile(sql::Connection* db, - AutofillProfile* profile) { - sql::Statement s(db->GetUniqueStatement( - "SELECT guid, type, number " - "FROM autofill_profile_phones " - "WHERE guid=? AND type=?")); - if (!s) { - NOTREACHED() << "Statement prepare failed"; - return false; - } - s.BindString(0, profile->guid()); - s.BindInt(1, kAutofillFaxNumber); - - std::vector<string16> numbers; - while (s.Step()) { - DCHECK_EQ(profile->guid(), s.ColumnString(0)); - numbers.push_back(s.ColumnString16(2)); - } - profile->SetMultiInfo(PHONE_FAX_WHOLE_NUMBER, numbers); - return true; -} - - bool AddAutofillProfileNames(const AutofillProfile& profile, sql::Connection* db) { std::vector<string16> first_names; @@ -296,20 +268,9 @@ bool AddAutofillProfileEmails(const AutofillProfile& profile, } bool AddAutofillProfilePhones(const AutofillProfile& profile, - AutofillPhoneType phone_type, sql::Connection* db) { - AutofillFieldType field_type; - if (phone_type == kAutofillPhoneNumber) { - field_type = PHONE_HOME_WHOLE_NUMBER; - } else if (phone_type == kAutofillFaxNumber) { - field_type = PHONE_FAX_WHOLE_NUMBER; - } else { - NOTREACHED(); - return false; - } - std::vector<string16> numbers; - profile.GetMultiInfo(field_type, &numbers); + profile.GetMultiInfo(PHONE_HOME_WHOLE_NUMBER, &numbers); for (size_t i = 0; i < numbers.size(); ++i) { // Add the new number. @@ -322,7 +283,8 @@ bool AddAutofillProfilePhones(const AutofillProfile& profile, return false; } s.BindString(0, profile.guid()); - s.BindInt(1, phone_type); + // Value used to be either [(0, phone), (1, fax)] but fax has been removed. + s.BindInt(1, 0); s.BindString16(2, numbers[i]); if (!s.Run()) { @@ -330,6 +292,7 @@ bool AddAutofillProfilePhones(const AutofillProfile& profile, return false; } } + return true; } @@ -341,10 +304,7 @@ bool AddAutofillProfilePieces(const AutofillProfile& profile, if (!AddAutofillProfileEmails(profile, db)) return false; - if (!AddAutofillProfilePhones(profile, kAutofillPhoneNumber, db)) - return false; - - if (!AddAutofillProfilePhones(profile, kAutofillFaxNumber, db)) + if (!AddAutofillProfilePhones(profile, db)) return false; return true; @@ -773,9 +733,8 @@ bool AutofillTable::GetAutofillTimestamps(const string16& name, s.BindString16(0, name); s.BindString16(1, value); - while (s.Step()) { + while (s.Step()) timestamps->push_back(Time::FromTimeT(s.ColumnInt64(0))); - } return s.Succeeded(); } @@ -943,9 +902,6 @@ bool AutofillTable::GetAutofillProfile(const std::string& guid, // Get associated phone info. AddAutofillProfilePhonesToProfile(db_, p.get()); - // Get associated fax info. - AddAutofillProfileFaxesToProfile(db_, p.get()); - *profile = p.release(); return true; } @@ -1006,10 +962,6 @@ bool AutofillTable::UpdateAutofillProfile(const AutofillProfile& profile) { values[0] = new_profile.GetInfo(PHONE_HOME_WHOLE_NUMBER); new_profile.SetMultiInfo(PHONE_HOME_WHOLE_NUMBER, values); - old_profile->GetMultiInfo(PHONE_FAX_WHOLE_NUMBER, &values); - values[0] = new_profile.GetInfo(PHONE_FAX_WHOLE_NUMBER); - new_profile.SetMultiInfo(PHONE_FAX_WHOLE_NUMBER, values); - return UpdateAutofillProfileMulti(new_profile); } @@ -1048,7 +1000,7 @@ bool AutofillTable::UpdateAutofillProfileMulti(const AutofillProfile& profile) { if (!result) return result; - // Remove the old names, emails, and phone/fax numbers. + // Remove the old names, emails, and phone numbers. if (!RemoveAutofillProfilePieces(profile.guid(), db_)) return false; @@ -1617,8 +1569,7 @@ bool AutofillTable::MigrateToVersion24CleanupOversizedStringFields() { " length(middle_name), length(last_name), length(email), " " length(company_name), length(address_line_1), " " length(address_line_2), length(city), length(state), " - " length(zipcode), length(country), length(phone), " - " length(fax)) > 500"; + " length(zipcode), length(country), length(phone)) > 500"; std::string query = "DELETE FROM autofill_dates WHERE pair_id IN (" "SELECT pair_id FROM autofill WHERE " + autofill_is_too_big + ")"; @@ -1869,7 +1820,6 @@ bool AutofillTable::MigrateToVersion32UpdateProfilesAndCreditCards() { "zipcode VARCHAR, " "country VARCHAR, " "phone VARCHAR, " - "fax VARCHAR, " "date_modified INTEGER NOT NULL DEFAULT 0)")) { return false; } @@ -1878,7 +1828,7 @@ bool AutofillTable::MigrateToVersion32UpdateProfilesAndCreditCards() { "INSERT INTO autofill_profiles_temp " "SELECT guid, label, first_name, middle_name, last_name, email, " "company_name, address_line_1, address_line_2, city, state, " - "zipcode, country, phone, fax, date_modified " + "zipcode, country, phone, date_modified " "FROM autofill_profiles")) { return false; } @@ -1947,7 +1897,7 @@ bool AutofillTable::MigrateToVersion33ProfilesBasedOnFirstName() { sql::Statement s(db_->GetUniqueStatement( "SELECT guid, first_name, middle_name, last_name, email, " "company_name, address_line_1, address_line_2, city, state, " - "zipcode, country, phone, fax, date_modified " + "zipcode, country, phone, date_modified " "FROM autofill_profiles")); while (s.Step()) { AutofillProfile profile; @@ -1966,8 +1916,7 @@ bool AutofillTable::MigrateToVersion33ProfilesBasedOnFirstName() { profile.SetInfo(ADDRESS_HOME_ZIP, s.ColumnString16(10)); profile.SetInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(11)); profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, s.ColumnString16(12)); - profile.SetInfo(PHONE_FAX_WHOLE_NUMBER, s.ColumnString16(13)); - int64 date_modified = s.ColumnInt64(14); + int64 date_modified = s.ColumnInt64(13); sql::Statement s_insert(db_->GetUniqueStatement( "INSERT INTO autofill_profiles_temp" @@ -1990,7 +1939,7 @@ bool AutofillTable::MigrateToVersion33ProfilesBasedOnFirstName() { if (!s_insert.Run()) return false; - // Add the other bits: names, emails, and phone/fax. + // Add the other bits: names, emails, and phone numbers. if (!AddAutofillProfilePieces(profile, db_)) return false; } diff --git a/chrome/browser/webdata/autofill_table.h b/chrome/browser/webdata/autofill_table.h index 6418d96..aceef0b 100644 --- a/chrome/browser/webdata/autofill_table.h +++ b/chrome/browser/webdata/autofill_table.h @@ -87,9 +87,11 @@ struct FormField; // associated with a profile. // // guid The guid string that identifies the profile to which -// the phone or fax number belongs. -// type An integer constant designating either phone or fax type -// of the number. +// the phone number belongs. +// type An integer constant designating either phone type of the +// number. +// TODO(jhawkins): Remove the type column and migrate the +// database. // number // // autofill_profiles_trash diff --git a/chrome/browser/webdata/autofill_table_unittest.cc b/chrome/browser/webdata/autofill_table_unittest.cc index ca37e70..4b2e61e 100644 --- a/chrome/browser/webdata/autofill_table_unittest.cc +++ b/chrome/browser/webdata/autofill_table_unittest.cc @@ -559,7 +559,6 @@ TEST_F(AutofillTableTest, AutofillProfile) { home_profile.SetInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("90025")); home_profile.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US")); home_profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("18181234567")); - home_profile.SetInfo(PHONE_FAX_WHOLE_NUMBER, ASCIIToUTF16("1915243678")); Time pre_creation_time = Time::Now(); EXPECT_TRUE(db.GetAutofillTable()->AddAutofillProfile(home_profile)); @@ -640,7 +639,6 @@ TEST_F(AutofillTableTest, AutofillProfile) { billing_profile.SetInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("10011")); billing_profile.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("United States")); billing_profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("18181230000")); - billing_profile.SetInfo(PHONE_FAX_WHOLE_NUMBER, ASCIIToUTF16("1915240000")); Time pre_modification_time_2 = Time::Now(); EXPECT_TRUE(db.GetAutofillTable()->UpdateAutofillProfileMulti( billing_profile)); @@ -828,47 +826,6 @@ TEST_F(AutofillTableTest, AutofillProfileMultiValuePhone) { delete db_profile; } -TEST_F(AutofillTableTest, AutofillProfileMultiValueFax) { - WebDatabase db; - ASSERT_EQ(sql::INIT_OK, db.Init(file_)); - - AutofillProfile p; - const string16 kJohnDoe(ASCIIToUTF16("4151112222")); - const string16 kJohnPDoe(ASCIIToUTF16("4151113333")); - std::vector<string16> set_values; - set_values.push_back(kJohnDoe); - set_values.push_back(kJohnPDoe); - p.SetMultiInfo(PHONE_FAX_WHOLE_NUMBER, set_values); - - EXPECT_TRUE(db.GetAutofillTable()->AddAutofillProfile(p)); - - AutofillProfile* db_profile; - ASSERT_TRUE(db.GetAutofillTable()->GetAutofillProfile(p.guid(), &db_profile)); - EXPECT_EQ(p, *db_profile); - EXPECT_EQ(0, p.CompareMulti(*db_profile)); - delete db_profile; - - // Update the values. - const string16 kNoOne(ASCIIToUTF16("4151110000")); - set_values[1] = kNoOne; - p.SetMultiInfo(PHONE_FAX_WHOLE_NUMBER, set_values); - EXPECT_TRUE(db.GetAutofillTable()->UpdateAutofillProfileMulti(p)); - ASSERT_TRUE(db.GetAutofillTable()->GetAutofillProfile(p.guid(), &db_profile)); - EXPECT_EQ(p, *db_profile); - EXPECT_EQ(0, p.CompareMulti(*db_profile)); - delete db_profile; - - // Delete values. - set_values.clear(); - p.SetMultiInfo(PHONE_FAX_WHOLE_NUMBER, set_values); - EXPECT_TRUE(db.GetAutofillTable()->UpdateAutofillProfileMulti(p)); - ASSERT_TRUE(db.GetAutofillTable()->GetAutofillProfile(p.guid(), &db_profile)); - EXPECT_EQ(p, *db_profile); - EXPECT_EQ(0, p.CompareMulti(*db_profile)); - EXPECT_EQ(string16(), db_profile->GetInfo(EMAIL_ADDRESS)); - delete db_profile; -} - TEST_F(AutofillTableTest, AutofillProfileTrash) { WebDatabase db; @@ -1071,7 +1028,6 @@ TEST_F(AutofillTableTest, UpdateAutofillProfile) { profile.SetInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("90025")); profile.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US")); profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("18181234567")); - profile.SetInfo(PHONE_FAX_WHOLE_NUMBER, ASCIIToUTF16("1915243678")); db.GetAutofillTable()->AddAutofillProfile(profile); // Set a mocked value for the profile's creation time. diff --git a/chrome/browser/webdata/web_database_migration_unittest.cc b/chrome/browser/webdata/web_database_migration_unittest.cc index e6e7355..1fe0315 100644 --- a/chrome/browser/webdata/web_database_migration_unittest.cc +++ b/chrome/browser/webdata/web_database_migration_unittest.cc @@ -51,7 +51,6 @@ void AutofillProfile31FromStatement(const sql::Statement& s, profile->SetInfo(ADDRESS_HOME_ZIP, s.ColumnString16(11)); profile->SetInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(12)); profile->SetInfo(PHONE_HOME_WHOLE_NUMBER, s.ColumnString16(13)); - profile->SetInfo(PHONE_FAX_WHOLE_NUMBER, s.ColumnString16(14)); *date_modified = s.ColumnInt64(15); profile->set_guid(s.ColumnString(16)); EXPECT_TRUE(guid::IsValidGUID(profile->guid())); @@ -1167,10 +1166,7 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion32ToCurrent) { EXPECT_EQ(ASCIIToUTF16("4151112222"), s4.ColumnString16(2)); // John Doe fax. - ASSERT_TRUE(s4.Step()); - EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s4.ColumnString(0)); - EXPECT_EQ(1, s4.ColumnInt(1)); // 1 means phone. - EXPECT_EQ(ASCIIToUTF16("4153334444"), s4.ColumnString16(2)); + // Gets culled after fax type removed. // John P. Doe phone. // Gets culled during migration from 35 to 37 due to merging of John Doe and @@ -1187,10 +1183,7 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion32ToCurrent) { EXPECT_EQ(ASCIIToUTF16(""), s4.ColumnString16(2)); // 2 Main Street fax. - ASSERT_TRUE(s4.Step()); - EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s4.ColumnString(0)); - EXPECT_EQ(1, s4.ColumnInt(1)); // 1 means fax. - EXPECT_EQ(ASCIIToUTF16(""), s4.ColumnString16(2)); + // Gets culled after fax type removed. // 2 Main St phone. ASSERT_TRUE(s4.Step()); @@ -1199,10 +1192,7 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion32ToCurrent) { EXPECT_EQ(ASCIIToUTF16(""), s4.ColumnString16(2)); // 2 Main St fax. - ASSERT_TRUE(s4.Step()); - EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s4.ColumnString(0)); - EXPECT_EQ(1, s4.ColumnInt(1)); // 1 means fax. - EXPECT_EQ(ASCIIToUTF16(""), s4.ColumnString16(2)); + // Gets culled after fax type removed. // Note no phone or fax for Alfred E Newman. @@ -1213,10 +1203,7 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion32ToCurrent) { EXPECT_EQ(ASCIIToUTF16(""), s4.ColumnString16(2)); // 2 Main St fax. - ASSERT_TRUE(s4.Step()); - EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s4.ColumnString(0)); - EXPECT_EQ(1, s4.ColumnInt(1)); // 1 means fax. - EXPECT_EQ(ASCIIToUTF16(""), s4.ColumnString16(2)); + // Gets culled after fax type removed. // Should be all. EXPECT_FALSE(s4.Step()); |