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

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

Issue 1031153002: [Credential Management] Smart lock save Credentials bubble should not always pop up. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/password_manager_unittest.cc
diff --git a/components/password_manager/core/browser/password_manager_unittest.cc b/components/password_manager/core/browser/password_manager_unittest.cc
index 5266521fa165fd61e8266494203c3c37e63ad2a9..94a666630d5539ca070187298e45f549a7790f4b 100644
--- a/components/password_manager/core/browser/password_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_manager_unittest.cc
@@ -737,16 +737,43 @@ TEST_F(PasswordManagerTest, AutofillingNotEnabledOnSSLErrors) {
manager()->OnPasswordFormsParsed(&driver_, forms);
}
-TEST_F(PasswordManagerTest, SavingDisabledIfManagerDisabled) {
+TEST_F(PasswordManagerTest, SavingDisabledIfManagerDisabledWithSSLErrors) {
vabr (Chromium) 2015/03/30 10:58:43 Two more kinds of tests for both saving and autofi
EXPECT_CALL(client_, IsPasswordManagerEnabledForCurrentPage())
.WillRepeatedly(Return(false));
+ EXPECT_CALL(client_, DidLastPageLoadEncounterSSLErrors())
+ .WillRepeatedly(Return(true));
EXPECT_FALSE(manager()->IsSavingEnabledForCurrentPage());
}
-TEST_F(PasswordManagerTest, AutofillingDisabledIfManagerDisabled) {
+TEST_F(PasswordManagerTest, SavingDisabledIfManagerDisabledWithoutSSLErros) {
EXPECT_CALL(client_, IsPasswordManagerEnabledForCurrentPage())
.WillRepeatedly(Return(false));
+ EXPECT_CALL(client_, DidLastPageLoadEncounterSSLErrors())
+ .WillRepeatedly(Return(false));
+ EXPECT_FALSE(manager()->IsSavingEnabledForCurrentPage());
+}
+TEST_F(PasswordManagerTest, AutofillingDisabledIfManagerDisabledWithSSLErrors) {
+ EXPECT_CALL(client_, IsPasswordManagerEnabledForCurrentPage())
+ .WillRepeatedly(Return(false));
+ EXPECT_CALL(client_, DidLastPageLoadEncounterSSLErrors())
+ .WillRepeatedly(Return(true));
+ // Let us pretend some forms were found on a website.
+ std::vector<PasswordForm> forms;
+ forms.push_back(MakeSimpleForm());
+
+ // Feed those forms to |manager()| and check that it does not try to find
+ // matching saved credentials for the forms.
+ EXPECT_CALL(*store_, GetLogins(_, _, _)).Times(Exactly(0));
+ manager()->OnPasswordFormsParsed(&driver_, forms);
+}
+
+TEST_F(PasswordManagerTest,
+ AutofillingDisabledIfManagerDisabledWithoutSSLErrors) {
+ EXPECT_CALL(client_, IsPasswordManagerEnabledForCurrentPage())
+ .WillRepeatedly(Return(false));
+ EXPECT_CALL(client_, DidLastPageLoadEncounterSSLErrors())
+ .WillRepeatedly(Return(false));
// Let us pretend some forms were found on a website.
std::vector<PasswordForm> forms;
forms.push_back(MakeSimpleForm());

Powered by Google App Engine
This is Rietveld 408576698