Commit 41291e14 authored by Christoph Schwering's avatar Christoph Schwering Committed by Commit Bot

Revert "[Autofill] Remove finch guard to import unfocusable fields"

This reverts commit 2239f82c.
The CL crrev.com/c/2506575 is broke the aeropostale and bestbuy
captured-site tests starting with build 3111:
https://ci.chromium.org/p/chrome/builders/ci/linux-autofill-captured-sites-rel?limit=200

Bug: 1101280
Change-Id: Iaab775e74c8ec5c20616973f031ce6597deb2290
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2538213
Commit-Queue: Christoph Schwering <schwering@google.com>
Reviewed-by: default avatarMatthias Körber <koerber@google.com>
Cr-Commit-Position: refs/heads/master@{#827762}
parent ee76edf7
......@@ -539,8 +539,14 @@ bool FormDataImporter::ImportAddressProfileForSection(
base::TrimWhitespace(field->value, base::TRIM_ALL, &value);
// If we don't know the type of the field, or the user hasn't entered any
// information into the field, then skip it.
if (!field->IsFieldFillable() || value.empty())
// information into the field, or the field is non-focusable (hidden), then
// skip it.
// TODO(crbug.com/1101280): Remove |skip_unfocussable_field|
bool skip_unfocussable_field =
!field->is_focusable &&
!base::FeatureList::IsEnabled(
features::kAutofillProfileImportFromUnfocusableFields);
if (!field->IsFieldFillable() || skip_unfocussable_field || value.empty())
continue;
AutofillType field_type = field->Type();
......
......@@ -830,9 +830,7 @@ TEST_P(FormDataImporterTest,
EXPECT_EQ(0, expected.Compare(*results[0]));
}
// Test that a form is imported correctly even if some fields are not
// focusable.
TEST_P(FormDataImporterTest, ImportAddressProfiles_WithUnFocussableFields) {
TEST_P(FormDataImporterTest, ImportAddressProfiles_UnFocussableFields) {
FormData form;
form.url = GURL("https://wwww.foo.com");
......@@ -854,8 +852,7 @@ TEST_P(FormDataImporterTest, ImportAddressProfiles_WithUnFocussableFields) {
form.fields.push_back(field);
test::CreateTestFormField("City:", "city", "San Francisco", "text", &field);
// Set this field to be not focusable.
// Set this field to be unfocusable.
field.is_focusable = false;
form.fields.push_back(field);
......@@ -868,6 +865,18 @@ TEST_P(FormDataImporterTest, ImportAddressProfiles_WithUnFocussableFields) {
FormStructure form_structure(form);
form_structure.DetermineHeuristicTypes();
// Verify the status quo that the form is not imported with the unfocusable
// fields.
// TODO(crbug.com/1101280): Remove once feature is launched.
scoped_feature_list_.Reset();
scoped_feature_list_.InitAndDisableFeature(
features::kAutofillProfileImportFromUnfocusableFields);
ImportAddressProfiles(/*extraction_successful=*/false, form_structure);
// Activate the feature and test again.
scoped_feature_list_.Reset();
scoped_feature_list_.InitAndEnableFeature(
features::kAutofillProfileImportFromUnfocusableFields);
ImportAddressProfiles(/*extraction_successful=*/true, form_structure);
AutofillProfile expected(base::GenerateGUID(), test::kEmptyOrigin);
......
......@@ -194,6 +194,11 @@ const base::Feature kAutofillProbableFormSubmissionInBrowser{
const base::Feature kAutofillProfileClientValidation{
"AutofillProfileClientValidation", base::FEATURE_DISABLED_BY_DEFAULT};
// TODO(crbug.com/1101280): Remove once feature is tested.
const base::Feature kAutofillProfileImportFromUnfocusableFields{
"AutofillProfileImportFromUnfocusableFields",
base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether Autofill uses server-side validation to ensure that fields
// with invalid data are not suggested.
const base::Feature kAutofillProfileServerValidation{
......
......@@ -55,6 +55,7 @@ extern const base::Feature kAutofillOffNoServerData;
extern const base::Feature kAutofillPreventMixedFormsFilling;
extern const base::Feature kAutofillProbableFormSubmissionInBrowser;
extern const base::Feature kAutofillProfileClientValidation;
extern const base::Feature kAutofillProfileImportFromUnfocusableFields;
extern const base::Feature kAutofillProfileServerValidation;
extern const base::Feature kAutofillRestrictUnownedFieldsToFormlessCheckout;
extern const base::Feature kAutofillRichMetadataQueries;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment