Skip to content

Commit

Permalink
[Autofill] Removed obsolete features AutofillEnforceMinRequiredFields*.
Browse files Browse the repository at this point in the history
The features are not subject to an active experiment.
* AutofillEnforceMinRequiredFieldsForHeuristics is enabled.
* AutofillEnforceMinRequiredFieldsForQuery is disabled.
* AutofillEnforceMinRequiredFieldsForUpload is disabled.

Bug: 1007974
Change-Id: I17c634d07f5e7b69fbf16708fe89cbe81d2ee617
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2411937
Reviewed-by: Steven Holte <holte@chromium.org>
Reviewed-by: Matthias Körber <koerber@google.com>
Reviewed-by: Moe Ahmadi <mahmadi@chromium.org>
Commit-Queue: Christoph Schwering <schwering@google.com>
Cr-Commit-Position: refs/heads/master@{#824633}
  • Loading branch information
schwering authored and Commit Bot committed Nov 5, 2020
1 parent 9a749c2 commit b80a984
Show file tree
Hide file tree
Showing 56 changed files with 133 additions and 1,041 deletions.
19 changes: 0 additions & 19 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4668,25 +4668,6 @@ const FeatureEntry kFeatureEntries[] = {
kOsMac | kOsWin | kOsLinux,
FEATURE_VALUE_TYPE(autofill::features::kAutofillEnableToolbarStatusChip)},

{"autofill-enforce-min-required-fields-for-heuristics",
flag_descriptions::kAutofillEnforceMinRequiredFieldsForHeuristicsName,
flag_descriptions::
kAutofillEnforceMinRequiredFieldsForHeuristicsDescription,
kOsAll,
FEATURE_VALUE_TYPE(
autofill::features::kAutofillEnforceMinRequiredFieldsForHeuristics)},
{"autofill-enforce-min-required-fields-for-query",
flag_descriptions::kAutofillEnforceMinRequiredFieldsForQueryName,
flag_descriptions::kAutofillEnforceMinRequiredFieldsForQueryDescription,
kOsAll,
FEATURE_VALUE_TYPE(
autofill::features::kAutofillEnforceMinRequiredFieldsForQuery)},
{"autofill-enforce-min-required-fields-for-upload",
flag_descriptions::kAutofillEnforceMinRequiredFieldsForUploadName,
flag_descriptions::kAutofillEnforceMinRequiredFieldsForUploadDescription,
kOsAll,
FEATURE_VALUE_TYPE(
autofill::features::kAutofillEnforceMinRequiredFieldsForUpload)},
{"autofill-rich-metadata-queries",
flag_descriptions::kAutofillRichMetadataQueriesName,
flag_descriptions::kAutofillRichMetadataQueriesDescription, kOsAll,
Expand Down
5 changes: 1 addition & 4 deletions chrome/browser/autofill/autofill_interactive_uitest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2554,10 +2554,7 @@ class AutofillRestrictUnownedFieldsTest
protected:
AutofillRestrictUnownedFieldsTest() : restrict_unowned_fields_(GetParam()) {
std::vector<base::Feature> enabled;
std::vector<base::Feature> disabled = {
features::kAutofillEnforceMinRequiredFieldsForHeuristics,
features::kAutofillEnforceMinRequiredFieldsForQuery,
features::kAutofillEnforceMinRequiredFieldsForUpload};
std::vector<base::Feature> disabled;
(restrict_unowned_fields_ ? enabled : disabled)
.push_back(features::kAutofillRestrictUnownedFieldsToFormlessCheckout);
scoped_feature_list_.InitWithFeatures(enabled, disabled);
Expand Down
5 changes: 1 addition & 4 deletions chrome/browser/autofill/form_structure_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,7 @@ FormStructureBrowserTest::FormStructureBrowserTest()
autofill::features::kAutofillEnableSupportForMoreStructureInAddresses,
},
// Disabled
{autofill::features::kAutofillEnforceMinRequiredFieldsForHeuristics,
autofill::features::kAutofillEnforceMinRequiredFieldsForQuery,
autofill::features::kAutofillEnforceMinRequiredFieldsForUpload,
autofill::features::kAutofillRestrictUnownedFieldsToFormlessCheckout});
{autofill::features::kAutofillRestrictUnownedFieldsToFormlessCheckout});
}

FormStructureBrowserTest::~FormStructureBrowserTest() {}
Expand Down
18 changes: 0 additions & 18 deletions chrome/browser/flag_descriptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,24 +237,6 @@ const char kAutofillEnableVirtualCardDescription[] =
"When enabled, if all requirements are met, Autofill will offer to use "
"virtual credit cards in form filling.";

const char kAutofillEnforceMinRequiredFieldsForHeuristicsName[] =
"Autofill Enforce Min Required Fields For Heuristics";
const char kAutofillEnforceMinRequiredFieldsForHeuristicsDescription[] =
"When enabled, autofill will generally require a form to have at least 3 "
"fields before allowing heuristic field-type prediction to occur.";

const char kAutofillEnforceMinRequiredFieldsForQueryName[] =
"Autofill Enforce Min Required Fields For Query";
const char kAutofillEnforceMinRequiredFieldsForQueryDescription[] =
"When enabled, autofill will generally require a form to have at least 3 "
"fields before querying the autofill server for field-type predictions.";

const char kAutofillEnforceMinRequiredFieldsForUploadName[] =
"Autofill Enforce Min Required Fields For Upload";
const char kAutofillEnforceMinRequiredFieldsForUploadDescription[] =
"When enabled, autofill will generally require a form to have at least 3 "
"fillable fields before uploading field-type votes for that form.";

const char kAutofillOffNoServerDataName[] = "Autofill Off No Server Data";
const char kAutofillOffNoServerDataDescription[] =
"Disables Autofill for fields with autocomplete off that have no "
Expand Down
8 changes: 0 additions & 8 deletions chrome/browser/flag_descriptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,6 @@ extern const char kAutofillEnableToolbarStatusChipDescription[];
extern const char kAutofillEnableVirtualCardName[];
extern const char kAutofillEnableVirtualCardDescription[];

// Enforcing restrictions to enable/disable autofill small form support.
extern const char kAutofillEnforceMinRequiredFieldsForHeuristicsName[];
extern const char kAutofillEnforceMinRequiredFieldsForHeuristicsDescription[];
extern const char kAutofillEnforceMinRequiredFieldsForQueryName[];
extern const char kAutofillEnforceMinRequiredFieldsForQueryDescription[];
extern const char kAutofillEnforceMinRequiredFieldsForUploadName[];
extern const char kAutofillEnforceMinRequiredFieldsForUploadDescription[];

extern const char kAutofillOffNoServerDataName[];
extern const char kAutofillOffNoServerDataDescription[];

Expand Down
49 changes: 0 additions & 49 deletions chrome/renderer/autofill/autofill_renderer_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_view.h"

using autofill::features::kAutofillEnforceMinRequiredFieldsForHeuristics;
using autofill::features::kAutofillEnforceMinRequiredFieldsForQuery;
using autofill::features::kAutofillEnforceMinRequiredFieldsForUpload;
using base::ASCIIToUTF16;
using blink::WebDocument;
using blink::WebElement;
Expand Down Expand Up @@ -273,52 +270,6 @@ TEST_F(AutofillRendererTest, SendForms) {
EXPECT_FORM_FIELD_DATA_EQUALS(expected, forms[0].fields[2]);
}

TEST_F(AutofillRendererTest, NoSmallFormsWhenMinimumEnforced) {
base::test::ScopedFeatureList feature_list;
feature_list.InitWithFeatures(
// Enabled.
{kAutofillEnforceMinRequiredFieldsForHeuristics,
kAutofillEnforceMinRequiredFieldsForQuery,
kAutofillEnforceMinRequiredFieldsForUpload},
// Disabled.
{});

LoadHTML("<form method='POST'>"
" <input type='text' id='firstname'/>"
" <input type='text' id='middlename'/>"
"</form>");

base::RunLoop run_loop;
run_loop.RunUntilIdle();
// Verify that "FormsSeen" isn't sent, as there are too few fields.
ASSERT_TRUE(fake_driver_.forms());
const std::vector<FormData>& forms = *(fake_driver_.forms());
ASSERT_EQ(0UL, forms.size());
}

TEST_F(AutofillRendererTest, SmallFormsFoundWhenMinimumNotEnforced) {
base::test::ScopedFeatureList feature_list;
feature_list.InitWithFeatures(
// Enabled.
{},
// Disabled.
{kAutofillEnforceMinRequiredFieldsForHeuristics,
kAutofillEnforceMinRequiredFieldsForQuery,
kAutofillEnforceMinRequiredFieldsForUpload});
LoadHTML(
"<form method='POST'>"
" <input type='text' id='firstname'/>"
" <input type='text' id='middlename'/>"
"</form>");

base::RunLoop run_loop;
run_loop.RunUntilIdle();
// Verify that "FormsSeen" isn't sent, as there are too few fields.
ASSERT_TRUE(fake_driver_.forms());
const std::vector<FormData>& forms = *(fake_driver_.forms());
ASSERT_EQ(1UL, forms.size());
}

// Regression test for [ http://crbug.com/346010 ].
TEST_F(AutofillRendererTest, DontCrashWhileAssociatingForms) {
LoadHTML("<form id='form'>"
Expand Down
88 changes: 0 additions & 88 deletions chrome/renderer/autofill/form_autofill_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@
#include "third_party/blink/public/web/win/web_font_rendering.h"
#endif

using autofill::features::kAutofillEnforceMinRequiredFieldsForHeuristics;
using autofill::features::kAutofillEnforceMinRequiredFieldsForQuery;
using autofill::features::kAutofillEnforceMinRequiredFieldsForUpload;
using base::ASCIIToUTF16;
using blink::WebAutofillState;
using blink::WebDocument;
Expand Down Expand Up @@ -3441,43 +3438,6 @@ TEST_F(FormAutofillTest, OnlyExtractNewForms) {
EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[2]);
}

// We should not extract a form if it has too few fillable fields.
TEST_F(FormAutofillTest, ExtractFormsTooFewFields) {
LoadHTML("<FORM name='TestForm' action='http://cnn.com' method='post'>"
" <INPUT type='text' id='firstname' value='John'/>"
" <INPUT type='text' id='lastname' value='Smith'/>"
" <INPUT type='submit' name='reply-send' value='Send'/>"
"</FORM>");

WebLocalFrame* web_frame = GetMainFrame();
ASSERT_NE(nullptr, web_frame);

// If all minimums are enforced, we ignore this form.
{
base::test::ScopedFeatureList feature_list;
feature_list.InitWithFeatures(
// Enabled.
{kAutofillEnforceMinRequiredFieldsForHeuristics,
kAutofillEnforceMinRequiredFieldsForQuery,
kAutofillEnforceMinRequiredFieldsForUpload},
// Disabled.
{});
ASSERT_TRUE(FormCache(web_frame).ExtractNewForms(nullptr).empty());
}

// If at least one of the minimums is not enforced, we parse the form.
{
base::test::ScopedFeatureList feature_list;
feature_list.InitWithFeatures(
// Enabled.
{kAutofillEnforceMinRequiredFieldsForHeuristics,
kAutofillEnforceMinRequiredFieldsForQuery},
// Disabled.
{kAutofillEnforceMinRequiredFieldsForUpload});
ASSERT_FALSE(FormCache(web_frame).ExtractNewForms(nullptr).empty());
}
}

// We should not report additional forms for empty forms.
TEST_F(FormAutofillTest, ExtractFormsNoFields) {
LoadHTML("<FORM name='TestForm' action='http://cnn.com' method='post'>"
Expand All @@ -3491,47 +3451,6 @@ TEST_F(FormAutofillTest, ExtractFormsNoFields) {
ASSERT_TRUE(forms.empty());
}

// We should not extract a form if it has too few fillable fields.
// Make sure radio and checkbox fields don't count.
TEST_F(FormAutofillTest, ExtractFormsTooFewFieldsSkipsCheckable) {
LoadHTML("<FORM name='TestForm' action='http://cnn.com' method='post'>"
" <INPUT type='text' id='firstname' value='John'/>"
" <INPUT type='text' id='lastname' value='Smith'/>"
" <INPUT type='radio' id='a_radio' value='0'/>"
" <INPUT type='checkbox' id='a_check' value='1'/>"
" <INPUT type='submit' name='reply-send' value='Send'/>"
"</FORM>");

WebLocalFrame* web_frame = GetMainFrame();
ASSERT_NE(nullptr, web_frame);

// Without small form support, the form is not parsed.
{
base::test::ScopedFeatureList feature_list;
feature_list.InitWithFeatures(
// Enabled.
{kAutofillEnforceMinRequiredFieldsForHeuristics,
kAutofillEnforceMinRequiredFieldsForQuery,
kAutofillEnforceMinRequiredFieldsForUpload},
// Disabled.
{});
ASSERT_TRUE(FormCache(web_frame).ExtractNewForms(nullptr).empty());
}

// With small form support, the form is parsed.
{
base::test::ScopedFeatureList feature_list;
feature_list.InitWithFeatures(
// Enabled.
{},
// Disabled.
{kAutofillEnforceMinRequiredFieldsForHeuristics,
kAutofillEnforceMinRequiredFieldsForQuery,
kAutofillEnforceMinRequiredFieldsForUpload});
ASSERT_FALSE(FormCache(web_frame).ExtractNewForms(nullptr).empty());
}
}

TEST_F(FormAutofillTest, WebFormElementToFormDataAutocomplete) {
{
// Form is still Autofill-able despite autocomplete=off.
Expand Down Expand Up @@ -5627,13 +5546,6 @@ TEST_F(FormAutofillTest, FormlessForms) {
}

TEST_F(FormAutofillTest, FormCache_ExtractNewForms) {
base::test::ScopedFeatureList feature_list;
feature_list.InitWithFeatures(
// Enabled.
{kAutofillEnforceMinRequiredFieldsForHeuristics,
kAutofillEnforceMinRequiredFieldsForQuery},
// Disabled.
{kAutofillEnforceMinRequiredFieldsForUpload});
struct {
const char* description;
const char* html;
Expand Down
6 changes: 3 additions & 3 deletions components/autofill/content/renderer/form_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ bool IsFormInteresting(const FormData& form, size_t num_editable_elements) {
// If there are no autocomplete attributes, the form needs to have at least
// the required number of editable fields for the prediction routines to be a
// candidate for autofill.
return num_editable_elements >= MinRequiredFieldsForHeuristics() ||
num_editable_elements >= MinRequiredFieldsForQuery() ||
num_editable_elements >= MinRequiredFieldsForUpload() ||
return num_editable_elements >= kMinRequiredFieldsForHeuristics ||
num_editable_elements >= kMinRequiredFieldsForQuery ||
num_editable_elements >= kMinRequiredFieldsForUpload ||
(all_fields_are_passwords &&
num_editable_elements >=
kRequiredFieldsForFormsWithOnlyPasswordFields);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2062,8 +2062,7 @@ TEST_P(AutofillUploadTest, ThrottlingDisabled) {
// Enabled.
{},
// Disabled
{features::kAutofillUploadThrottling,
features::kAutofillEnforceMinRequiredFieldsForUpload});
{features::kAutofillUploadThrottling});

FormData form;
FormData small_form;
Expand Down
Loading

0 comments on commit b80a984

Please sign in to comment.