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

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

Issue 16296002: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 7 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: 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 dfdd956786f68ee672f3e12b859096836ae5c572..8ce8e3957a556656b6d59db4131ed198535738ab 100644
--- a/chrome/browser/password_manager/password_manager_unittest.cc
+++ b/chrome/browser/password_manager/password_manager_unittest.cc
@@ -117,7 +117,7 @@ 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_, GetLogins(_,_))
+ EXPECT_CALL(*store_.get(), GetLogins(_, _))
.WillOnce(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
@@ -138,7 +138,7 @@ TEST_F(PasswordManagerTest, FormSubmitEmptyStore) {
manager()->OnPasswordFormsRendered(observed); // The post-navigation layout.
ASSERT_TRUE(form_to_save.get());
- EXPECT_CALL(*store_, AddLogin(FormMatches(form)));
+ EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form)));
// Simulate saving the form, as if the info bar was accepted.
form_to_save->Save();
@@ -149,7 +149,7 @@ 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_, GetLogins(_,_))
+ EXPECT_CALL(*store_.get(), GetLogins(_, _))
.WillOnce(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
@@ -166,7 +166,7 @@ TEST_F(PasswordManagerTest, GeneratedPasswordFormSubmitEmptyStore) {
// navigation occurs.
EXPECT_CALL(delegate_,
AddSavePasswordInfoBarIfPermitted(_)).Times(Exactly(0));
- EXPECT_CALL(*store_, AddLogin(FormMatches(form)));
+ EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form)));
// Now the password manager waits for the navigation to complete.
observed.clear();
@@ -183,7 +183,7 @@ TEST_F(PasswordManagerTest, FormSubmitNoGoodMatch) {
existing_different->username_value = ASCIIToUTF16("google2");
result.push_back(existing_different);
EXPECT_CALL(delegate_, FillPasswordForm(_));
- EXPECT_CALL(*store_, GetLogins(_,_))
+ EXPECT_CALL(*store_.get(), GetLogins(_, _))
.WillOnce(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
@@ -204,7 +204,7 @@ TEST_F(PasswordManagerTest, FormSubmitNoGoodMatch) {
manager()->OnPasswordFormsRendered(observed); // The post-navigation layout.
ASSERT_TRUE(form_to_save.get());
- EXPECT_CALL(*store_, AddLogin(FormMatches(form)));
+ EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form)));
// Simulate saving the form.
form_to_save->Save();
@@ -213,7 +213,7 @@ 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_, GetLogins(_,_))
+ EXPECT_CALL(*store_.get(), GetLogins(_, _))
.WillOnce(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
@@ -241,7 +241,7 @@ TEST_F(PasswordManagerTest, FormSubmitAfterNavigateSubframe) {
// password infobar.
std::vector<PasswordForm*> result; // Empty password store.
EXPECT_CALL(delegate_, FillPasswordForm(_)).Times(Exactly(0));
- EXPECT_CALL(*store_, GetLogins(_,_))
+ EXPECT_CALL(*store_.get(), GetLogins(_, _))
.WillOnce(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
@@ -270,7 +270,7 @@ TEST_F(PasswordManagerTest, FormSubmitAfterNavigateSubframe) {
manager()->OnPasswordFormsRendered(observed); // The post-navigation layout.
ASSERT_FALSE(NULL == form_to_save.get());
- EXPECT_CALL(*store_, AddLogin(FormMatches(form)));
+ EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form)));
// Simulate saving the form, as if the info bar was accepted.
form_to_save->Save();
@@ -280,7 +280,7 @@ 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_, GetLogins(_,_))
+ EXPECT_CALL(*store_.get(), GetLogins(_, _))
.WillRepeatedly(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
PasswordForm first_form(MakeSimpleForm());
first_form.origin = GURL("http://www.nytimes.com/");
@@ -324,7 +324,7 @@ TEST_F(PasswordManagerTest, FormSubmitWithFormOnPreviousPage) {
// Make sure that the saved form matches the second form, not the first.
ASSERT_TRUE(form_to_save.get());
- EXPECT_CALL(*store_, AddLogin(FormMatches(second_form)));
+ EXPECT_CALL(*store_.get(), AddLogin(FormMatches(second_form)));
// Simulate saving the form, as if the info bar was accepted.
form_to_save->Save();
@@ -333,7 +333,7 @@ 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_, GetLogins(_,_))
+ EXPECT_CALL(*store_.get(), GetLogins(_, _))
.WillRepeatedly(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
@@ -354,7 +354,7 @@ 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_, GetLogins(_,_))
+ EXPECT_CALL(*store_.get(), GetLogins(_, _))
.WillRepeatedly(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
@@ -375,7 +375,7 @@ TEST_F(PasswordManagerTest, FormSubmitInvisibleLogin) {
manager()->OnPasswordFormsRendered(observed);
ASSERT_TRUE(form_to_save.get());
- EXPECT_CALL(*store_, AddLogin(FormMatches(form)));
+ EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form)));
// Simulate saving the form.
form_to_save->Save();
@@ -387,7 +387,7 @@ TEST_F(PasswordManagerTest, InitiallyInvisibleForm) {
PasswordForm* existing = new PasswordForm(MakeSimpleForm());
result.push_back(existing);
EXPECT_CALL(delegate_, FillPasswordForm(_));
- EXPECT_CALL(*store_, GetLogins(_,_))
+ EXPECT_CALL(*store_.get(), GetLogins(_, _))
.WillRepeatedly(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
@@ -424,7 +424,7 @@ TEST_F(PasswordManagerTest, FillPasswordsOnDisabledManager) {
prefService->SetUserPref(prefs::kPasswordManagerEnabled,
Value::CreateBooleanValue(false));
EXPECT_CALL(delegate_, FillPasswordForm(_));
- EXPECT_CALL(*store_, GetLogins(_, _))
+ EXPECT_CALL(*store_.get(), GetLogins(_, _))
.WillRepeatedly(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
@@ -437,7 +437,7 @@ TEST_F(PasswordManagerTest, FormNotSavedAutocompleteOff) {
// autocomplete=off.
std::vector<PasswordForm*> result; // Empty password store.
EXPECT_CALL(delegate_, FillPasswordForm(_)).Times(Exactly(0));
- EXPECT_CALL(*store_, GetLogins(_,_))
+ EXPECT_CALL(*store_.get(), GetLogins(_, _))
.WillOnce(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
@@ -452,7 +452,7 @@ TEST_F(PasswordManagerTest, FormNotSavedAutocompleteOff) {
// Password form should not be saved.
EXPECT_CALL(delegate_,
AddSavePasswordInfoBarIfPermitted(_)).Times(Exactly(0));
- EXPECT_CALL(*store_, AddLogin(FormMatches(form))).Times(Exactly(0));
+ EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))).Times(Exactly(0));
// Now the password manager waits for the navigation to complete.
observed.clear();
@@ -465,7 +465,7 @@ TEST_F(PasswordManagerTest, GeneratedPasswordFormSavedAutocompleteOff) {
// autocomplete=off.
std::vector<PasswordForm*> result; // Empty password store.
EXPECT_CALL(delegate_, FillPasswordForm(_)).Times(Exactly(0));
- EXPECT_CALL(*store_, GetLogins(_,_))
+ EXPECT_CALL(*store_.get(), GetLogins(_, _))
.WillOnce(DoAll(WithArg<1>(InvokeConsumer(result)), Return(1)));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
@@ -483,7 +483,7 @@ TEST_F(PasswordManagerTest, GeneratedPasswordFormSavedAutocompleteOff) {
// navigation occurs.
EXPECT_CALL(delegate_,
AddSavePasswordInfoBarIfPermitted(_)).Times(Exactly(0));
- EXPECT_CALL(*store_, AddLogin(FormMatches(form)));
+ EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form)));
// Now the password manager waits for the navigation to complete.
observed.clear();

Powered by Google App Engine
This is Rietveld 408576698