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

Unified Diff: components/password_manager/core/browser/password_generation_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, 8 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_generation_manager_unittest.cc
diff --git a/components/password_manager/core/browser/password_generation_manager_unittest.cc b/components/password_manager/core/browser/password_generation_manager_unittest.cc
index 97913e2dfe4bea533c1f6ddb9254c4e22506539e..d01d5f52488cb5534ec8706bbd7c789ca60fe385 100644
--- a/components/password_manager/core/browser/password_generation_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_generation_manager_unittest.cc
@@ -123,8 +123,8 @@ class PasswordGenerationManagerTest : public testing::Test {
TEST_F(PasswordGenerationManagerTest, IsGenerationEnabled) {
// Enabling the PasswordManager and password sync should cause generation to
// be enabled.
- PrefService* prefs = client_->GetPrefs();
- prefs->SetBoolean(prefs::kPasswordManagerSavingEnabled, true);
+ EXPECT_CALL(*client_, IsSavingEnabledForCurrentPage())
+ .WillRepeatedly(testing::Return(true));
EXPECT_CALL(*client_, IsPasswordSyncEnabled(_))
.WillRepeatedly(testing::Return(true));
EXPECT_TRUE(IsGenerationEnabled());
@@ -136,7 +136,8 @@ TEST_F(PasswordGenerationManagerTest, IsGenerationEnabled) {
// Disabling the PasswordManager should cause generation to be disabled even
// if syncing is enabled.
- prefs->SetBoolean(prefs::kPasswordManagerSavingEnabled, false);
+ EXPECT_CALL(*client_, IsSavingEnabledForCurrentPage())
+ .WillRepeatedly(testing::Return(false));
EXPECT_CALL(*client_, IsPasswordSyncEnabled(_))
.WillRepeatedly(testing::Return(true));
EXPECT_FALSE(IsGenerationEnabled());
@@ -144,8 +145,8 @@ TEST_F(PasswordGenerationManagerTest, IsGenerationEnabled) {
TEST_F(PasswordGenerationManagerTest, DetectAccountCreationForms) {
// Setup so that IsGenerationEnabled() returns true.
- PrefService* prefs = client_->GetPrefs();
- prefs->SetBoolean(prefs::kPasswordManagerSavingEnabled, true);
+ EXPECT_CALL(*client_, IsSavingEnabledForCurrentPage())
+ .WillRepeatedly(testing::Return(true));
EXPECT_CALL(*client_, IsPasswordSyncEnabled(_))
.WillRepeatedly(testing::Return(true));

Powered by Google App Engine
This is Rietveld 408576698