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

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

Issue 2634163002: Fetch federated PSL-matches from the password store. (Closed)
Patch Set: Created 3 years, 11 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/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..0443d10e303ea2cf5476d44307be5317b0c86972 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/");
+ 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.

Powered by Google App Engine
This is Rietveld 408576698