Skip to content

Commit

Permalink
Clean-up AutofillEnableExtendedAddressFormats.
Browse files Browse the repository at this point in the history
Bug: 1300548
Change-Id: Ic1e1d930acde0b084e4f60dd206cb6a3ad255729
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3933019
Reviewed-by: Matthias Körber <koerber@google.com>
Commit-Queue: Florian Leimgruber <fleimgruber@google.com>
Cr-Commit-Position: refs/heads/main@{#1067500}
  • Loading branch information
florianleimgruber authored and Chromium LUCI CQ committed Nov 4, 2022
1 parent 582454a commit 4f77737
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 47 deletions.
17 changes: 6 additions & 11 deletions chrome/test/data/webui/settings/autofill_section_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,6 @@ suite('AutofillSectionAddressLocaleTests', function() {
const address = createEmptyAddressEntry();
const company_enabled = loadTimeData.getBoolean('EnableCompanyName');
const honorific_enabled = loadTimeData.getBoolean('showHonorific');
const extended_address_format_enabled =
loadTimeData.getBoolean('EnableExtendedAddressFormat');

address.honorific = 'Lord';
address.fullNames = ['Name'];
Expand All @@ -613,8 +611,7 @@ suite('AutofillSectionAddressLocaleTests', function() {
return createAddressDialog(address).then(function(dialog) {
const rows = dialog.$.dialog.querySelectorAll('.address-row');
assertEquals(
6 + (company_enabled ? 1 : 0) + (honorific_enabled ? 1 : 0) +
(extended_address_format_enabled ? 1 : 0),
7 + (company_enabled ? 1 : 0) + (honorific_enabled ? 1 : 0),
rows.length);

let index = 0;
Expand Down Expand Up @@ -674,13 +671,11 @@ suite('AutofillSectionAddressLocaleTests', function() {
assertEquals(address.postalCode, cols[0]!.value);
index++;
// County
if (extended_address_format_enabled) {
row = rows[index]!;
cols = row.querySelectorAll<SettingsTextareaElement|CrInputElement>(
'.address-column');
assertEquals(1, cols.length);
assertEquals(address.addressLevel1, cols[0]!.value);
}
row = rows[index]!;
cols = row.querySelectorAll<SettingsTextareaElement|CrInputElement>(
'.address-column');
assertEquals(1, cols.length);
assertEquals(address.addressLevel1, cols[0]!.value);
index++;
// Phone, Email
row = rows[index]!;
Expand Down
8 changes: 0 additions & 8 deletions chrome/test/data/webui/settings/cr_settings_browsertest.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,21 +262,13 @@ var CrSettingsAutofillSectionCompanyEnabledTest =
get browsePreload() {
return 'chrome://settings/test_loader.html?module=settings/autofill_section_test.js';
}

/** @override */
get featureListInternal() {
return {
enabled: ['autofill::features::kAutofillEnableExtendedAddressFormats'],
};
}
};

TEST_F('CrSettingsAutofillSectionCompanyEnabledTest', 'All', function() {
// Use 'EnableCompanyName' to inform tests that the feature is enabled.
const loadTimeDataOverride = {};
loadTimeDataOverride['EnableCompanyName'] = true;
loadTimeDataOverride['showHonorific'] = true;
loadTimeDataOverride['EnableExtendedAddressFormat'] = true;
loadTimeData.overrideValues(loadTimeDataOverride);
mocha.run();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ TEST_F(AddressFormattingTest, GetAddressComponentsSkipsEmptyLines) {
// Tests that address field extensions are applied to `GetAddressComponents()`,
// by checking that Great Britain's address format is extended by a state field.
TEST_F(AddressFormattingTest, GetAddressComponentsWithExtensions) {
base::test::ScopedFeatureList address_extension_feature;
address_extension_feature.InitAndEnableFeature(
features::kAutofillEnableExtendedAddressFormats);

std::vector<std::vector<::i18n::addressinput::AddressUiComponent>> lines;
std::string components_language_code;
autofill::GetAddressComponents("GB", GetLocale(), /*include_literals=*/false,
Expand Down Expand Up @@ -175,10 +171,6 @@ TEST_F(
// `GetEnvelopeStyleAddress()`, by checking that Great Britain's address format
// is extended by a state field.
TEST_F(AddressFormattingTest, GetEnvelopeStyleAddressWithExtensions) {
base::test::ScopedFeatureList address_extension_feature;
address_extension_feature.InitAndEnableFeature(
features::kAutofillEnableExtendedAddressFormats);

AutofillProfile profile(base::GenerateGUID(), /*origin=*/"");
test::SetProfileInfo(&profile, "FirstName", "MiddleName", "LastName",
"johndoe@hades.com", /*company=*/"", "666 Erebus St.",
Expand Down
9 changes: 2 additions & 7 deletions components/autofill/core/browser/geo/autofill_country.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,8 @@ LogBuffer& operator<<(LogBuffer& buffer, const AutofillCountry& country) {

base::span<const AutofillCountry::AddressFormatExtension>
AutofillCountry::address_format_extensions() const {
if (!base::FeatureList::IsEnabled(
features::kAutofillEnableExtendedAddressFormats)) {
return {};
}

// TODO(crbug.com/1300548): Extend more countries. FR and GB are used to test
// the feature, because libaddressinput already provides string literals.
// TODO(crbug.com/1300548): Extend more countries. FR and GB already have
// overwrites, because libaddressinput already provides string literals.
static constexpr std::array<AddressFormatExtension, 1> fr_extensions{
{{.type = AddressField::ADMIN_AREA,
.label_id = IDS_LIBADDRESSINPUT_PROVINCE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@ TEST(AutofillCountryTest, AliasMappingsForCountryData) {
// not part of libaddressinputs expected types, but that they are placed
// after a field that is present in libaddressinput.
TEST(AutofillCountryTest, VerifyAddressFormatExtensions) {
base::test::ScopedFeatureList address_extension_feature;
address_extension_feature.InitAndEnableFeature(
features::kAutofillEnableExtendedAddressFormats);

CountryDataMap* country_data_map = CountryDataMap::GetInstance();
for (const std::string& country_code : country_data_map->country_codes()) {
AutofillCountry country(country_code);
Expand Down
7 changes: 0 additions & 7 deletions components/autofill/core/common/autofill_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,6 @@ BASE_FEATURE(kAutofillEnableDependentLocalityParsing,
"AutofillEnableDependentLocalityParsing",
base::FEATURE_DISABLED_BY_DEFAULT);

// Enables the augmentation layer for setting-inaccessible fields, which allows
// extending Autofill's address format by additional fields.
// TODO(crbug.com/1300548) Remove when launched.
BASE_FEATURE(kAutofillEnableExtendedAddressFormats,
"AutofillEnableExtendedAddressFormats",
base::FEATURE_ENABLED_BY_DEFAULT);

// Controls whether to save the first number in a form with multiple phone
// numbers instead of aborting the import.
// TODO(crbug.com/1167484) Remove once launched.
Expand Down
2 changes: 0 additions & 2 deletions components/autofill/core/common/autofill_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ BASE_DECLARE_FEATURE(kAutofillEnableBirthdateParsing);
COMPONENT_EXPORT(AUTOFILL)
BASE_DECLARE_FEATURE(kAutofillEnableDependentLocalityParsing);
COMPONENT_EXPORT(AUTOFILL)
BASE_DECLARE_FEATURE(kAutofillEnableExtendedAddressFormats);
COMPONENT_EXPORT(AUTOFILL)
BASE_DECLARE_FEATURE(kAutofillEnableImportWhenMultiplePhoneNumbers);
COMPONENT_EXPORT(AUTOFILL)
BASE_DECLARE_FEATURE(kAutofillEnableMultiStepImports);
Expand Down

0 comments on commit 4f77737

Please sign in to comment.