Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(659)

Unified Diff: components/autofill/content/renderer/password_form_conversion_utils_browsertest.cc

Issue 2985373002: Revert of [Password Manager] Send username correction votes (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/content/renderer/password_form_conversion_utils_browsertest.cc
diff --git a/components/autofill/content/renderer/password_form_conversion_utils_browsertest.cc b/components/autofill/content/renderer/password_form_conversion_utils_browsertest.cc
index f9d353441a27c7fd5e9231a1a0af6270d16a1284..3a3ac4b51a536bb4745a1e8d7f87a50187f07b1c 100644
--- a/components/autofill/content/renderer/password_form_conversion_utils_browsertest.cc
+++ b/components/autofill/content/renderer/password_form_conversion_utils_browsertest.cc
@@ -298,10 +298,7 @@
// When no elements are marked with autocomplete='username', the text-type
// input field before the first password element should get selected as
// the username, and the rest should be marked as alternatives.
- {{nullptr, nullptr, nullptr},
- "username2",
- "William",
- "John+username1, Smith+username3"},
+ {{nullptr, nullptr, nullptr}, "username2", "William", "John+Smith"},
// When a sole element is marked with autocomplete='username', it should
// be treated as the username for sure, with no other_possible_usernames.
{{"username", nullptr, nullptr}, "username1", "John", ""},
@@ -309,36 +306,21 @@
{{nullptr, nullptr, "username"}, "username3", "Smith", ""},
// When >=2 elements have the attribute, the first should be selected as
// the username, and the rest should go to other_possible_usernames.
- {{"username", "username", nullptr},
+ {{"username", "username", nullptr}, "username1", "John", "William"},
+ {{nullptr, "username", "username"}, "username2", "William", "Smith"},
+ {{"username", nullptr, "username"}, "username1", "John", "Smith"},
+ {{"username", "username", "username"},
"username1",
"John",
- "William+username2"},
- {{nullptr, "username", "username"},
- "username2",
- "William",
- "Smith+username3"},
- {{"username", nullptr, "username"},
- "username1",
- "John",
- "Smith+username3"},
- {{"username", "username", "username"},
- "username1",
- "John",
- "William+username2, Smith+username3"},
+ "William+Smith"},
// When there is an empty autocomplete attribute (i.e. autocomplete=""),
// it should have the same effect as having no attribute whatsoever.
- {{"", "", ""}, "username2", "William", "John+username1, Smith+username3"},
+ {{"", "", ""}, "username2", "William", "John+Smith"},
{{"", "", "username"}, "username3", "Smith", ""},
- {{"username", "", "username"}, "username1", "John", "Smith+username3"},
+ {{"username", "", "username"}, "username1", "John", "Smith"},
// It should not matter if attribute values are upper or mixed case.
- {{"USERNAME", nullptr, "uSeRNaMe"},
- "username1",
- "John",
- "Smith+username3"},
- {{"uSeRNaMe", nullptr, "USERNAME"},
- "username1",
- "John",
- "Smith+username3"}};
+ {{"USERNAME", nullptr, "uSeRNaMe"}, "username1", "John", "Smith"},
+ {{"uSeRNaMe", nullptr, "USERNAME"}, "username1", "John", "Smith"}};
for (size_t i = 0; i < arraysize(cases); ++i) {
for (size_t nonempty_username_fields = 0; nonempty_username_fields < 2;
@@ -378,8 +360,8 @@
EXPECT_EQ(base::UTF8ToUTF16(cases[i].expected_username_value),
password_form->username_value);
EXPECT_EQ(base::UTF8ToUTF16(cases[i].expected_other_possible_usernames),
- OtherPossibleUsernamesToString(
- password_form->other_possible_usernames));
+ base::JoinString(password_form->other_possible_usernames,
+ base::ASCIIToUTF16("+")));
} else {
EXPECT_TRUE(password_form->username_value.empty());
EXPECT_TRUE(password_form->other_possible_usernames.empty());
@@ -445,10 +427,8 @@
// Do a basic sanity check that we are still selecting the right username.
EXPECT_EQ(base::UTF8ToUTF16("username1"), password_form->username_element);
EXPECT_EQ(base::UTF8ToUTF16("William"), password_form->username_value);
- EXPECT_THAT(
- password_form->other_possible_usernames,
- testing::ElementsAre(PossibleUsernamePair(
- base::UTF8ToUTF16("Smith"), base::UTF8ToUTF16("username2"))));
+ EXPECT_THAT(password_form->other_possible_usernames,
+ testing::ElementsAre(base::UTF8ToUTF16("Smith")));
}
}
@@ -516,10 +496,8 @@
// Do a basic sanity check that we are still selecting the right username.
EXPECT_EQ(base::UTF8ToUTF16("username1"), password_form->username_element);
EXPECT_EQ(base::UTF8ToUTF16("William"), password_form->username_value);
- EXPECT_THAT(
- password_form->other_possible_usernames,
- testing::ElementsAre(PossibleUsernamePair(
- base::UTF8ToUTF16("Smith"), base::UTF8ToUTF16("username2"))));
+ EXPECT_THAT(password_form->other_possible_usernames,
+ testing::ElementsAre(base::UTF8ToUTF16("Smith")));
}
}
@@ -870,15 +848,11 @@
EXPECT_EQ(base::UTF8ToUTF16(cases[i].expected_username_value),
password_form->username_value);
if (strcmp(cases[i].expected_username_value, "William") == 0) {
- EXPECT_THAT(
- password_form->other_possible_usernames,
- testing::ElementsAre(PossibleUsernamePair(
- base::UTF8ToUTF16("Smith"), base::UTF8ToUTF16("username2"))));
+ EXPECT_THAT(password_form->other_possible_usernames,
+ testing::ElementsAre(base::UTF8ToUTF16("Smith")));
} else {
- EXPECT_THAT(
- password_form->other_possible_usernames,
- testing::ElementsAre(PossibleUsernamePair(
- base::UTF8ToUTF16("William"), base::UTF8ToUTF16("username1"))));
+ EXPECT_THAT(password_form->other_possible_usernames,
+ testing::ElementsAre(base::UTF8ToUTF16("William")));
}
EXPECT_EQ(base::UTF8ToUTF16(cases[i].expected_password_element),
password_form->password_element);

Powered by Google App Engine
This is Rietveld 408576698