Chromium Code Reviews| 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 61bc4fad00256ca95d9d883b52a61411d4c499b4..e04d1c25c32b281c5736fd0523a9cb2868afa25f 100644 |
| --- a/components/password_manager/core/browser/login_database_unittest.cc |
| +++ b/components/password_manager/core/browser/login_database_unittest.cc |
| @@ -431,6 +431,37 @@ TEST_F(LoginDatabaseTest, TestFederatedMatching) { |
| EXPECT_THAT(result, UnorderedElementsAre(Pointee(form), Pointee(form2))); |
| } |
| +TEST_F(LoginDatabaseTest, TestFederatedMatchingLocalhost) { |
| + PasswordForm form; |
| + form.origin = GURL("http://localhost/"); |
| + form.signon_realm = "federation://localhost/accounts.google.com"; |
| + form.federation_origin = url::Origin(GURL("https://accounts.google.com/")); |
| + form.username_value = ASCIIToUTF16("test@gmail.com"); |
| + form.type = PasswordForm::TYPE_API; |
| + form.scheme = PasswordForm::SCHEME_HTML; |
| + |
| + PasswordForm form_with_port(form); |
| + form_with_port.origin = GURL("http://localhost:8080/"); |
| + form_with_port.signon_realm = "federation://localhost/accounts.google.com"; |
| + |
| + EXPECT_EQ(AddChangeForForm(form), db().AddLogin(form)); |
| + EXPECT_EQ(AddChangeForForm(form_with_port), db().AddLogin(form_with_port)); |
| + |
| + // Match twice. |
|
vabr (Chromium)
2017/04/13 18:12:09
I'm not sure I understand "twice". Could you expla
vasilii
2017/04/13 18:16:59
I call GetLogins twice.
|
| + PasswordStore::FormDigest form_request(PasswordForm::SCHEME_HTML, |
| + "http://localhost/", |
| + GURL("http://localhost/")); |
| + std::vector<std::unique_ptr<PasswordForm>> result; |
| + EXPECT_TRUE(db().GetLogins(form_request, &result)); |
| + EXPECT_THAT(result, UnorderedElementsAre(Pointee(form))); |
| + |
| + // Match against the mobile site. |
|
vabr (Chromium)
2017/04/13 18:12:09
What mobile site are you referring to? localhost:8
vasilii
2017/04/13 18:16:59
Copy/paste problem :)
|
| + form_request.origin = GURL("http://localhost:8080/"); |
| + form_request.signon_realm = "http://localhost:8080/"; |
| + EXPECT_TRUE(db().GetLogins(form_request, &result)); |
| + EXPECT_THAT(result, UnorderedElementsAre(Pointee(form_with_port))); |
| +} |
| + |
| TEST_F(LoginDatabaseTest, TestPublicSuffixDisabledForNonHTMLForms) { |
| TestNonHTMLFormPSLMatching(PasswordForm::SCHEME_BASIC); |
| TestNonHTMLFormPSLMatching(PasswordForm::SCHEME_DIGEST); |