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

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

Issue 2606493002: Fetch federated PSL-matches from the password store. (Closed)
Patch Set: Created 4 years 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 | « no previous file | 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/login_database_unittest.cc
diff --git a/components/password_manager/core/browser/login_database_unittest.cc b/components/password_manager/core/browser/login_database_unittest.cc
index 248f70cc2bfb89669baca62706d636e8283d6f33..5da4e81ce725f19552881bdcf4094286bbdf6180 100644
--- a/components/password_manager/core/browser/login_database_unittest.cc
+++ b/components/password_manager/core/browser/login_database_unittest.cc
@@ -534,6 +534,28 @@ TEST_F(LoginDatabaseTest, TestFederatedMatchingWithoutPSLMatching) {
EXPECT_THAT(result, testing::ElementsAre(Pointee(form2)));
}
+TEST_F(LoginDatabaseTest, TestFederatedPSLMatching) {
+ // Save a federated credential for the PSL matched site.
+ PasswordForm form;
+ form.origin = GURL("https://psl.example.com.com/");
+ form.action = GURL("https://psl.example.com/login");
+ form.signon_realm = "federation://psl.example.com/accounts.google.com";
+ form.username_value = ASCIIToUTF16("test1@gmail.com");
+ form.type = PasswordForm::TYPE_API;
+ form.federation_origin = url::Origin(GURL("https://accounts.google.com/"));
+ form.scheme = PasswordForm::SCHEME_HTML;
+ EXPECT_EQ(AddChangeForForm(form), db().AddLogin(form));
+
+ // Match against.
+ PasswordStore::FormDigest form_request = {PasswordForm::SCHEME_HTML,
+ "https://example.com/",
+ GURL("https://example.com/login") };
+ std::vector<std::unique_ptr<PasswordForm>> result;
+ EXPECT_TRUE(db().GetLogins(form_request, &result));
+ form.is_public_suffix_match = true;
+ EXPECT_THAT(result, testing::ElementsAre(Pointee(form)));
+}
+
// This test fails if the implementation of GetLogins uses GetCachedStatement
// instead of GetUniqueStatement, since REGEXP is in use. See
// http://crbug.com/248608.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698