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

Unified Diff: components/password_manager/core/browser/password_form_manager_unittest.cc

Issue 1886283002: Blacklisting applied to the form and the page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed obfuscating mix of return trues and falses Created 4 years, 8 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
« no previous file with comments | « components/password_manager/core/browser/password_form_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/password_manager/core/browser/password_form_manager_unittest.cc
diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc
index fc60ff86c94065482d3a38c0b8a6eb4e9ef1674c..5cf5e62e84bb027fcfb4dc52e401a35bde4c3e1f 100644
--- a/components/password_manager/core/browser/password_form_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -762,25 +762,35 @@ TEST_F(PasswordFormManagerTest, TestBlacklistMatching) {
blacklisted_not_match.origin = GURL("http://google.com/a/LoginAuth");
blacklisted_not_match.blacklisted_by_user = true;
- // Doesn't match because of different username element.
+ // Doesn't match because of different username element and different page.
PasswordForm blacklisted_not_match2 = *observed_form();
+ blacklisted_not_match2.origin = GURL("http://accounts.google.com/a/Login123");
blacklisted_not_match2.username_element = ASCIIToUTF16("Element");
blacklisted_not_match2.blacklisted_by_user = true;
+ // Matches because of same element names, despite different page
PasswordForm blacklisted_match = *observed_form();
blacklisted_match.origin = GURL("http://accounts.google.com/a/LoginAuth1234");
blacklisted_match.blacklisted_by_user = true;
+ // Matches because of same page, despite different element names
+ PasswordForm blacklisted_match2 = *observed_form();
+ blacklisted_match2.origin = GURL("http://accounts.google.com/a/LoginAuth");
+ blacklisted_match2.username_element = ASCIIToUTF16("Element");
+ blacklisted_match2.blacklisted_by_user = true;
+
ScopedVector<PasswordForm> result;
result.push_back(new PasswordForm(blacklisted_psl));
result.push_back(new PasswordForm(blacklisted_not_match));
result.push_back(new PasswordForm(blacklisted_not_match2));
result.push_back(new PasswordForm(blacklisted_match));
+ result.push_back(new PasswordForm(blacklisted_match2));
result.push_back(new PasswordForm(*saved_match()));
form_manager.OnGetPasswordStoreResults(std::move(result));
EXPECT_TRUE(form_manager.IsBlacklisted());
- EXPECT_THAT(form_manager.blacklisted_matches(),
- ElementsAre(Pointee(blacklisted_match)));
+ EXPECT_THAT(
+ form_manager.blacklisted_matches(),
+ ElementsAre(Pointee(blacklisted_match), Pointee(blacklisted_match2)));
EXPECT_EQ(1u, form_manager.best_matches().size());
EXPECT_EQ(*saved_match(), *form_manager.preferred_match());
}
« no previous file with comments | « components/password_manager/core/browser/password_form_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698