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

Unified Diff: components/password_manager/content/browser/credential_manager_impl_unittest.cc

Issue 2447143002: Stop prerendering of a site if it uses the Credential Manager API. (Closed)
Patch Set: rebase Created 4 years, 2 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/content/browser/credential_manager_impl_unittest.cc
diff --git a/components/password_manager/content/browser/credential_manager_impl_unittest.cc b/components/password_manager/content/browser/credential_manager_impl_unittest.cc
index b9c6ef38f16e39c029f8a53a20243c6851e4512b..a3b064cd34cd5e0b9db83ef0d00972561a1d4ace 100644
--- a/components/password_manager/content/browser/credential_manager_impl_unittest.cc
+++ b/components/password_manager/content/browser/credential_manager_impl_unittest.cc
@@ -56,6 +56,7 @@ class MockPasswordManagerClient : public StubPasswordManagerClient {
public:
MOCK_CONST_METHOD0(IsSavingAndFillingEnabledForCurrentPage, bool());
MOCK_CONST_METHOD0(IsFillingEnabledForCurrentPage, bool());
+ MOCK_METHOD0(OnCredentialManagerUsed, bool());
MOCK_CONST_METHOD0(IsOffTheRecord, bool());
MOCK_METHOD0(NotifyUserAutoSigninPtr, bool());
MOCK_METHOD1(NotifyUserCouldBeAutoSignedInPtr,
@@ -215,6 +216,8 @@ class CredentialManagerImplTest : public content::RenderViewHostTestHarness {
.WillByDefault(testing::Return(true));
ON_CALL(*client_, IsFillingEnabledForCurrentPage())
.WillByDefault(testing::Return(true));
+ ON_CALL(*client_, OnCredentialManagerUsed())
+ .WillByDefault(testing::Return(true));
ON_CALL(*client_, IsOffTheRecord()).WillByDefault(testing::Return(false));
NavigateAndCommit(GURL("https://example.com/test.html"));
@@ -1037,6 +1040,18 @@ TEST_F(CredentialManagerImplTest, RequestCredentialWithTLSErrors) {
ExpectZeroClickSignInFailure(true, true, federations);
}
+TEST_F(CredentialManagerImplTest, RequestCredentialWhilePrerendering) {
+ // The client disallows the credential manager for the current page.
+ EXPECT_CALL(*client_, OnCredentialManagerUsed())
+ .WillRepeatedly(testing::Return(false));
+
+ store_->AddLogin(form_);
+
+ std::vector<GURL> federations;
+
+ ExpectZeroClickSignInFailure(true, true, federations);
+}
+
TEST_F(CredentialManagerImplTest,
CredentialManagerOnRequestCredentialWithZeroClickOnlyTwoPasswordStore) {
store_->AddLogin(form_);

Powered by Google App Engine
This is Rietveld 408576698