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

Unified Diff: chrome/browser/password_manager/password_manager_unittest.cc

Issue 106053008: [Mac] Passwords: Don't always prompt to access passwords saved by other browsers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix yet another compile failure. Created 7 years 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: chrome/browser/password_manager/password_manager_unittest.cc
diff --git a/chrome/browser/password_manager/password_manager_unittest.cc b/chrome/browser/password_manager/password_manager_unittest.cc
index ff20a0db9708e0dc1561c3633f67ed8ec9743802..20924846b83648bb1029b5da848ca4712be99c97 100644
--- a/chrome/browser/password_manager/password_manager_unittest.cc
+++ b/chrome/browser/password_manager/password_manager_unittest.cc
@@ -200,8 +200,8 @@ TEST_F(PasswordManagerTest, FormSubmitEmptyStore) {
// Test that observing a newly submitted form shows the save password bar.
std::vector<PasswordForm*> result; // Empty password store.
EXPECT_CALL(delegate_, FillPasswordForm(_)).Times(Exactly(0));
- EXPECT_CALL(*store_.get(), GetLogins(_, _))
- .WillOnce(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
+ EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
+ .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
observed.push_back(form);
@@ -232,8 +232,8 @@ TEST_F(PasswordManagerTest, GeneratedPasswordFormSubmitEmptyStore) {
// user generating the password through the browser.
std::vector<PasswordForm*> result; // Empty password store.
EXPECT_CALL(delegate_, FillPasswordForm(_)).Times(Exactly(0));
- EXPECT_CALL(*store_.get(), GetLogins(_, _))
- .WillOnce(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
+ EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
+ .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
observed.push_back(form);
@@ -266,8 +266,8 @@ TEST_F(PasswordManagerTest, FormSubmitNoGoodMatch) {
existing_different->username_value = ASCIIToUTF16("google2");
result.push_back(existing_different);
EXPECT_CALL(delegate_, FillPasswordForm(_));
- EXPECT_CALL(*store_.get(), GetLogins(_, _))
- .WillOnce(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
+ EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
+ .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
@@ -296,8 +296,8 @@ TEST_F(PasswordManagerTest, FormSubmitNoGoodMatch) {
TEST_F(PasswordManagerTest, FormSeenThenLeftPage) {
std::vector<PasswordForm*> result; // Empty password store.
EXPECT_CALL(delegate_, FillPasswordForm(_)).Times(Exactly(0));
- EXPECT_CALL(*store_.get(), GetLogins(_, _))
- .WillOnce(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
+ EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
+ .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
observed.push_back(form);
@@ -317,8 +317,8 @@ TEST_F(PasswordManagerTest, FormSubmitAfterNavigateSubframe) {
// password infobar.
std::vector<PasswordForm*> result; // Empty password store.
EXPECT_CALL(delegate_, FillPasswordForm(_)).Times(Exactly(0));
- EXPECT_CALL(*store_.get(), GetLogins(_, _))
- .WillOnce(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
+ EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
+ .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
observed.push_back(form);
@@ -353,8 +353,8 @@ TEST_F(PasswordManagerTest, FormSubmitAfterNavigateSubframe) {
TEST_F(PasswordManagerTest, FormSubmitWithFormOnPreviousPage) {
std::vector<PasswordForm*> result; // Empty password store.
EXPECT_CALL(delegate_, FillPasswordForm(_)).Times(Exactly(0));
- EXPECT_CALL(*store_.get(), GetLogins(_, _))
- .WillRepeatedly(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
+ EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
+ .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return(1)));
PasswordForm first_form(MakeSimpleForm());
first_form.origin = GURL("http://www.nytimes.com/");
first_form.action = GURL("https://myaccount.nytimes.com/auth/login");
@@ -405,8 +405,8 @@ TEST_F(PasswordManagerTest, FormSubmitWithFormOnPreviousPage) {
TEST_F(PasswordManagerTest, FormSubmitFailedLogin) {
std::vector<PasswordForm*> result; // Empty password store.
EXPECT_CALL(delegate_, FillPasswordForm(_)).Times(Exactly(0));
- EXPECT_CALL(*store_.get(), GetLogins(_, _))
- .WillRepeatedly(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
+ EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
+ .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
observed.push_back(form);
@@ -426,8 +426,8 @@ TEST_F(PasswordManagerTest, FormSubmitInvisibleLogin) {
// page, but is invisible, it shouldn't count as a failed login.
std::vector<PasswordForm*> result; // Empty password store.
EXPECT_CALL(delegate_, FillPasswordForm(_)).Times(Exactly(0));
- EXPECT_CALL(*store_.get(), GetLogins(_, _))
- .WillRepeatedly(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
+ EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
+ .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
observed.push_back(form);
@@ -459,8 +459,8 @@ TEST_F(PasswordManagerTest, InitiallyInvisibleForm) {
PasswordForm* existing = new PasswordForm(MakeSimpleForm());
result.push_back(existing);
EXPECT_CALL(delegate_, FillPasswordForm(_));
- EXPECT_CALL(*store_.get(), GetLogins(_, _))
- .WillRepeatedly(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
+ EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
+ .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
observed.push_back(form);
@@ -494,8 +494,9 @@ TEST_F(PasswordManagerTest, FillPasswordsOnDisabledManager) {
prefService->SetUserPref(prefs::kPasswordManagerEnabled,
Value::CreateBooleanValue(false));
EXPECT_CALL(delegate_, FillPasswordForm(_));
- EXPECT_CALL(*store_.get(), GetLogins(_, _))
- .WillRepeatedly(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
+ EXPECT_CALL(*store_.get(),
+ GetLogins(_, testing::Eq(PasswordStore::DISALLOW_PROMPT), _))
+ .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
observed.push_back(form);
@@ -507,8 +508,8 @@ TEST_F(PasswordManagerTest, FormNotSavedAutocompleteOff) {
// autocomplete=off.
std::vector<PasswordForm*> result; // Empty password store.
EXPECT_CALL(delegate_, FillPasswordForm(_)).Times(Exactly(0));
- EXPECT_CALL(*store_.get(), GetLogins(_, _))
- .WillOnce(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
+ EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
+ .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
form.password_autocomplete_set = false;
@@ -535,8 +536,8 @@ TEST_F(PasswordManagerTest, GeneratedPasswordFormSavedAutocompleteOff) {
// autocomplete=off.
std::vector<PasswordForm*> result; // Empty password store.
EXPECT_CALL(delegate_, FillPasswordForm(_)).Times(Exactly(0));
- EXPECT_CALL(*store_.get(), GetLogins(_, _))
- .WillOnce(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
+ EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
+ .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
form.password_autocomplete_set = false;
@@ -575,8 +576,8 @@ TEST_F(PasswordManagerTest, PasswordFormReappearance) {
// means that our previous login attempt failed.
std::vector<PasswordForm*> result; // Empty password store.
EXPECT_CALL(delegate_, FillPasswordForm(_)).Times(0);
- EXPECT_CALL(*store_.get(), GetLogins(_, _))
- .WillRepeatedly(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
+ EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
+ .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm login_form(MakeTwitterLoginForm());
observed.push_back(login_form);
« no previous file with comments | « chrome/browser/password_manager/password_manager.cc ('k') | chrome/browser/password_manager/password_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698