Skip to content

Commit

Permalink
Remove honorific prefix support from Autofill UI.
Browse files Browse the repository at this point in the history
The CL is part of the removal of honorific prefixes in Autofill. This
change removes the `AUTOFILL_ENABLE_SUPPORT_FOR_HONORIFIC_PREFIXES`
ChromeFeature flag and its uses.

Bug: b/320307442
Change-Id: I5acf5538754cc519f92ea16614396a670afdaaf1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5210355
Reviewed-by: Christoph Schwering <schwering@google.com>
Commit-Queue: Norge Vizcay <vizcay@google.com>
Cr-Commit-Position: refs/heads/main@{#1248731}
  • Loading branch information
norgevz authored and Chromium LUCI CQ committed Jan 18, 2024
1 parent a020f7e commit 4cc21c9
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 129 deletions.
Expand Up @@ -52,10 +52,7 @@
*/
@DoNotBatch(reason = "The tests can't be batched because they run for different set-ups.")
@RunWith(ParameterizedRunner.class)
@EnableFeatures({
ChromeFeatureList.AUTOFILL_ADDRESS_PROFILE_SAVE_PROMPT_NICKNAME_SUPPORT,
ChromeFeatureList.AUTOFILL_ENABLE_SUPPORT_FOR_HONORIFIC_PREFIXES
})
@EnableFeatures({ChromeFeatureList.AUTOFILL_ADDRESS_PROFILE_SAVE_PROMPT_NICKNAME_SUPPORT})
public class SaveUpdateAddressProfilePromptRenderTest extends BlankUiTestActivityTestCase {
private static final long NATIVE_SAVE_UPDATE_ADDRESS_PROFILE_PROMPT_CONTROLLER = 100L;

Expand Down
Expand Up @@ -173,7 +173,6 @@ public void tearDown() throws TimeoutException {
@Test
@MediumTest
@Feature({"Preferences"})
@EnableFeatures({ChromeFeatureList.AUTOFILL_ENABLE_SUPPORT_FOR_HONORIFIC_PREFIXES})
public void testAddProfile() throws Exception {
AutofillProfilesFragment autofillProfileFragment = sSettingsActivityTestRule.getFragment();

Expand Down Expand Up @@ -215,7 +214,6 @@ public void testAddProfile() throws Exception {
@Test
@MediumTest
@Feature({"Preferences"})
@EnableFeatures({ChromeFeatureList.AUTOFILL_ENABLE_SUPPORT_FOR_HONORIFIC_PREFIXES})
public void testAddIncompletedProfile() throws Exception {
AutofillProfilesFragment autofillProfileFragment = sSettingsActivityTestRule.getFragment();

Expand Down Expand Up @@ -247,7 +245,6 @@ public void testAddIncompletedProfile() throws Exception {
@Test
@MediumTest
@Feature({"Preferences"})
@EnableFeatures({ChromeFeatureList.AUTOFILL_ENABLE_SUPPORT_FOR_HONORIFIC_PREFIXES})
public void testAddProfileWithInvalidPhone() throws Exception {
AutofillProfilesFragment autofillProfileFragment = sSettingsActivityTestRule.getFragment();

Expand Down Expand Up @@ -389,7 +386,6 @@ public void testDeleteAccountProfile() throws Exception {
@Test
@MediumTest
@Feature({"Preferences"})
@EnableFeatures({ChromeFeatureList.AUTOFILL_ENABLE_SUPPORT_FOR_HONORIFIC_PREFIXES})
public void testEditProfile() throws Exception {
AutofillProfilesFragment autofillProfileFragment = sSettingsActivityTestRule.getFragment();

Expand Down Expand Up @@ -442,7 +438,6 @@ public void testEditProfile() throws Exception {
@Test
@MediumTest
@Feature({"Preferences"})
@EnableFeatures({ChromeFeatureList.AUTOFILL_ENABLE_SUPPORT_FOR_HONORIFIC_PREFIXES})
public void testEditAccountProfile() throws Exception {
String email = "test@account";
setUpMockPrimaryAccount(email);
Expand Down Expand Up @@ -528,7 +523,6 @@ public void testEditAccountProfile() throws Exception {
@Test
@MediumTest
@Feature({"Preferences"})
@EnableFeatures({ChromeFeatureList.AUTOFILL_ENABLE_SUPPORT_FOR_HONORIFIC_PREFIXES})
public void testEditInvalidAccountProfile() throws Exception {
mHelper.setProfile(
AutofillProfile.builder()
Expand Down
Expand Up @@ -55,10 +55,7 @@
/** Unit tests for {@link SaveUpdateAddressProfilePrompt}. */
@RunWith(BaseRobolectricTestRunner.class)
@Config(manifest = Config.NONE)
@EnableFeatures({
ChromeFeatureList.AUTOFILL_ADDRESS_PROFILE_SAVE_PROMPT_NICKNAME_SUPPORT,
ChromeFeatureList.AUTOFILL_ENABLE_SUPPORT_FOR_HONORIFIC_PREFIXES
})
@EnableFeatures({ChromeFeatureList.AUTOFILL_ADDRESS_PROFILE_SAVE_PROMPT_NICKNAME_SUPPORT})
public class SaveUpdateAddressProfilePromptTest {
private static final long NATIVE_SAVE_UPDATE_ADDRESS_PROFILE_PROMPT_CONTROLLER = 100L;
private static final boolean NO_MIGRATION = false;
Expand Down
Expand Up @@ -91,7 +91,6 @@ class AddressEditorMediator {
private final boolean mSaveToDisk;
private final Map<Integer, PropertyModel> mAddressFields = new HashMap<>();
private final PropertyModel mCountryField;
private final @Nullable PropertyModel mHonorificField;
private final PropertyModel mPhoneField;
private final PropertyModel mEmailField;
private final @Nullable PropertyModel mNicknameField;
Expand Down Expand Up @@ -161,23 +160,6 @@ private static List<DropdownKeyValue> getSupportedCountries(
.with(VALUE, AutofillAddress.getCountryCode(mProfileToEdit))
.build();

// Honorific prefix is present only for autofill settings.
mHonorificField =
ChromeFeatureList.isEnabled(
ChromeFeatureList.AUTOFILL_ENABLE_SUPPORT_FOR_HONORIFIC_PREFIXES)
? new PropertyModel.Builder(TEXT_ALL_KEYS)
.with(TEXT_FIELD_TYPE, FieldType.NAME_HONORIFIC_PREFIX)
.with(
LABEL,
mContext.getString(
R.string.autofill_profile_editor_honorific_prefix))
.with(IS_REQUIRED, false)
.with(
VALUE,
mProfileToEdit.getInfo(FieldType.NAME_HONORIFIC_PREFIX))
.build()
: null;

// Phone number is present for all countries.
mPhoneField =
new PropertyModel.Builder(TEXT_ALL_KEYS)
Expand Down Expand Up @@ -232,7 +214,6 @@ void setCustomDoneButtonText(@Nullable String customDoneButtonText) {
* Builds an editor model with the following fields.
*
* [ country dropdown ] <----- country dropdown is always present.
* [ honorific field ] <----- above name, present if purpose is Purpose.AUTOFILL_SETTINGS.
* [ an address field ] \
* [ an address field ] \
* ... <-- field order, presence, required, and labels depend on country.
Expand Down Expand Up @@ -323,12 +304,6 @@ private ListModel<FieldItem> buildEditorFieldList(String countryCode, String lan
editorFields.add(new FieldItem(DROPDOWN, mCountryField, /* isFullLine= */ true));

for (AutofillAddressUiComponent component : mVisibleEditorFields) {
// Honorific prefix should go before name.
if (component.id == FieldType.NAME_FULL && mHonorificField != null) {
editorFields.add(
new FieldItem(TEXT_INPUT, mHonorificField, /* isFullLine= */ true));
}

PropertyModel field = getFieldForFieldType(component.id);

// Labels depend on country, e.g., state is called province in some countries. These are
Expand Down Expand Up @@ -409,9 +384,6 @@ private void commitChanges(AutofillProfile profile) {
if (mEmailField != null) {
profile.setInfo(FieldType.EMAIL_ADDRESS, mEmailField.get(VALUE));
}
if (mHonorificField != null) {
profile.setInfo(FieldType.NAME_HONORIFIC_PREFIX, mHonorificField.get(VALUE));
}

// Autofill profile bridge normalizes the language code for the autofill profile.
profile.setLanguageCode(mAutofillProfileBridge.getCurrentBestLanguageCode());
Expand Down
Expand Up @@ -75,7 +75,6 @@
@RunWith(ParameterizedRunner.class)
@ParameterAnnotations.UseRunnerDelegate(ChromeJUnit4RunnerDelegate.class)
@EnableFeatures({
ChromeFeatureList.AUTOFILL_ENABLE_SUPPORT_FOR_HONORIFIC_PREFIXES,
ChromeFeatureList.AUTOFILL_ADDRESS_PROFILE_SAVE_PROMPT_NICKNAME_SUPPORT
})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
Expand Down Expand Up @@ -127,7 +126,7 @@ public class AddressEditorRenderTest extends BlankUiTestActivityTestCase {
@Rule
public final RenderTestRule mRenderTestRule =
RenderTestRule.Builder.withPublicCorpus()
.setRevision(0)
.setRevision(1)
.setBugComponent(Component.UI_BROWSER_AUTOFILL)
.build();

Expand Down

0 comments on commit 4cc21c9

Please sign in to comment.