Commit 99a4d0a2 authored by Matthias Körber's avatar Matthias Körber Committed by Commit Bot

[PasswordManager] Introduced Finch flag for overwriting placeholders in username fields

To allow for a better impact assessment, the feature to overwrite static placeholders in username fields is retroactively put behind a Finch flag.
Note that older version will always overwrite the static placeholder if the prediction from the server is supplied.

Bug: 1022291
Change-Id: I39f1ac557f7e9751d348b1df5796bfa276839e89
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1903351Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Commit-Queue: Matthias Körber <koerber@google.com>
Cr-Commit-Position: refs/heads/master@{#713418}
parent 6c4fac1b
......@@ -913,6 +913,10 @@ const FormFieldData* FindUsernameInPredictions(
bool GetMayUsePrefilledPlaceholder(
const base::Optional<FormPredictions>& form_predictions,
const SignificantFields& significant_fields) {
if (!base::FeatureList::IsEnabled(
password_manager::features::kEnableOverwritingPlaceholderUsernames))
return false;
if (!form_predictions || !significant_fields.username)
return false;
......
......@@ -1197,6 +1197,33 @@ TEST(FormParserTest, ServerPredictionsForClearTextPasswordFields) {
});
}
TEST(FormParserTest, ServerHintsForDisabledPrefilledPlaceholderFeature) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndDisableFeature(
password_manager::features::kEnableOverwritingPlaceholderUsernames);
CheckTestData({
{
.description_for_logging = "Simple predictions work",
.fields =
{
{.role = ElementRole::USERNAME,
.form_control_type = "text",
.prediction = {.type = autofill::USERNAME_AND_EMAIL_ADDRESS,
.may_use_prefilled_placeholder = true}},
{.form_control_type = "text"},
{.role_saving = ElementRole::CURRENT_PASSWORD,
.form_control_type = "password"},
{.role_filling = ElementRole::CURRENT_PASSWORD,
.role_saving = ElementRole::NEW_PASSWORD,
.form_control_type = "password",
.prediction = {.type = autofill::PASSWORD,
.may_use_prefilled_placeholder = true}},
},
.username_may_use_prefilled_placeholder = false,
},
});
}
TEST(FormParserTest, ServerHints) {
CheckTestData({
{
......
......@@ -20,6 +20,11 @@ const base::Feature kEditPasswordsInDesktopSettings = {
const base::Feature kDeleteCorruptedPasswords = {
"DeleteCorruptedPasswords", base::FEATURE_DISABLED_BY_DEFAULT};
// Enables the overwriting of prefilled username fields if the server predicted
// the field to contain a placeholder value.
const base::Feature kEnableOverwritingPlaceholderUsernames{
"EnableOverwritingPlaceholderUsernames", base::FEATURE_ENABLED_BY_DEFAULT};
// Enables a second, Gaia-account-scoped password store for users who are signed
// in but not syncing.
const base::Feature kEnablePasswordsAccountStorage = {
......
......@@ -19,6 +19,7 @@ namespace features {
extern const base::Feature kEditPasswordsInDesktopSettings;
extern const base::Feature kDeleteCorruptedPasswords;
extern const base::Feature kEnableOverwritingPlaceholderUsernames;
extern const base::Feature kEnablePasswordsAccountStorage;
extern const base::Feature KEnablePasswordGenerationForClearTextFields;
extern const base::Feature kFillOnAccountSelect;
......
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