Chromium Code Reviews| 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 22169b0eb3d047521aaebca44a459b866f5f800f..6329227b2090805fe0793964582de105aedd6ae9 100644 |
| --- a/components/password_manager/core/browser/password_manager_unittest.cc |
| +++ b/components/password_manager/core/browser/password_manager_unittest.cc |
| @@ -67,7 +67,9 @@ class MockPasswordManagerDriver : public StubPasswordManagerDriver { |
| MOCK_METHOD0(GetPasswordAutofillManager, PasswordAutofillManager*()); |
| }; |
| -ACTION_P(InvokeConsumer, forms) { arg0->OnGetPasswordStoreResults(forms); } |
| +ACTION_P(InvokeConsumer, forms) { |
| + arg0->OnGetPasswordStoreResults(forms->Pass()); |
| +} |
| ACTION_P(SaveToScopedPtr, scoped) { scoped->reset(arg0); } |
| @@ -90,7 +92,7 @@ class PasswordManagerTest : public testing::Test { |
| true); |
| store_ = new MockPasswordStore; |
| - EXPECT_CALL(*store_.get(), ReportMetrics(_, _)).Times(AnyNumber()); |
| + EXPECT_CALL(*store_, ReportMetrics(_, _)).Times(AnyNumber()); |
| CHECK(store_->Init(syncer::SyncableService::StartSyncFlare())); |
| EXPECT_CALL(client_, IsPasswordManagerEnabledForCurrentPage()) |
| @@ -242,10 +244,10 @@ MATCHER_P(FormMatches, form, "") { |
| TEST_F(PasswordManagerTest, FormSubmitEmptyStore) { |
| // Test that observing a newly submitted form shows the save password bar. |
| - std::vector<PasswordForm*> result; // Empty password store. |
| + ScopedVector<PasswordForm> result; // Empty password store. |
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) |
| - .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| + .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
|
vasilii
2015/02/05 19:23:27
Do you really need Return() here and below?
vabr (Chromium)
2015/02/06 14:16:05
No. :) Done.
|
| std::vector<PasswordForm> observed; |
| PasswordForm form(MakeSimpleForm()); |
| observed.push_back(form); |
| @@ -269,7 +271,7 @@ TEST_F(PasswordManagerTest, FormSubmitEmptyStore) { |
| manager()->OnPasswordFormsRendered(&driver_, observed, true); |
| ASSERT_TRUE(form_to_save.get()); |
| - EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); |
| + EXPECT_CALL(*store_, AddLogin(FormMatches(form))); |
| // Simulate saving the form, as if the info bar was accepted. |
| form_to_save->Save(); |
| @@ -302,8 +304,7 @@ TEST_F(PasswordManagerTest, FormSubmitWithOnlyNewPasswordField) { |
| // Simulate saving the form, as if the info bar was accepted. |
| PasswordForm saved_form; |
| - EXPECT_CALL(*store_.get(), AddLogin(_)) |
| - .WillOnce(testing::SaveArg<0>(&saved_form)); |
| + EXPECT_CALL(*store_, AddLogin(_)).WillOnce(testing::SaveArg<0>(&saved_form)); |
| form_to_save->Save(); |
| // The value of the new password field should have been promoted to, and saved |
| @@ -320,10 +321,10 @@ TEST_F(PasswordManagerTest, FormSubmitWithOnlyNewPasswordField) { |
| TEST_F(PasswordManagerTest, GeneratedPasswordFormSubmitEmptyStore) { |
| // This test is the same as FormSubmitEmptyStore, except that it simulates the |
| // user generating the password through the browser. |
| - std::vector<PasswordForm*> result; // Empty password store. |
| + ScopedVector<PasswordForm> result; // Empty password store. |
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) |
| - .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| + .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| std::vector<PasswordForm> observed; |
| PasswordForm form(MakeSimpleForm()); |
| observed.push_back(form); |
| @@ -341,7 +342,7 @@ TEST_F(PasswordManagerTest, GeneratedPasswordFormSubmitEmptyStore) { |
| // navigation occurs. The client will be informed that automatic saving has |
| // occured. |
| EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(Exactly(0)); |
| - EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); |
| + EXPECT_CALL(*store_, AddLogin(FormMatches(form))); |
| scoped_ptr<PasswordFormManager> saved_form_manager; |
| EXPECT_CALL(client_, AutomaticPasswordSavePtr(_)) |
| .Times(Exactly(1)) |
| @@ -359,13 +360,14 @@ TEST_F(PasswordManagerTest, FormSubmitNoGoodMatch) { |
| // Same as above, except with an existing form for the same signon realm, |
| // but different origin. Detailed cases like this are covered by |
| // PasswordFormManagerTest. |
| - std::vector<PasswordForm*> result; |
| - PasswordForm* existing_different = new PasswordForm(MakeSimpleForm()); |
| + ScopedVector<PasswordForm> result; |
| + scoped_ptr<PasswordForm> existing_different( |
| + new PasswordForm(MakeSimpleForm())); |
| existing_different->username_value = ASCIIToUTF16("google2"); |
| - result.push_back(existing_different); |
| + result.push_back(existing_different.release()); |
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(2); |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) |
| - .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| + .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| std::vector<PasswordForm> observed; |
| PasswordForm form(MakeSimpleForm()); |
| @@ -388,17 +390,17 @@ TEST_F(PasswordManagerTest, FormSubmitNoGoodMatch) { |
| true); // The post-navigation layout. |
| ASSERT_TRUE(form_to_save.get()); |
| - EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); |
| + EXPECT_CALL(*store_, AddLogin(FormMatches(form))); |
| // Simulate saving the form. |
| form_to_save->Save(); |
| } |
| TEST_F(PasswordManagerTest, FormSeenThenLeftPage) { |
| - std::vector<PasswordForm*> result; // Empty password store. |
| + ScopedVector<PasswordForm> result; // Empty password store. |
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) |
| - .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| + .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| std::vector<PasswordForm> observed; |
| PasswordForm form(MakeSimpleForm()); |
| observed.push_back(form); |
| @@ -419,10 +421,10 @@ TEST_F(PasswordManagerTest, FormSeenThenLeftPage) { |
| TEST_F(PasswordManagerTest, FormSubmitAfterNavigateInPage) { |
| // Test that navigating in the page does not prevent us from showing the save |
| // password infobar. |
| - std::vector<PasswordForm*> result; // Empty password store. |
| + ScopedVector<PasswordForm> result; // Empty password store. |
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) |
| - .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| + .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| std::vector<PasswordForm> observed; |
| PasswordForm form(MakeSimpleForm()); |
| observed.push_back(form); |
| @@ -445,7 +447,7 @@ TEST_F(PasswordManagerTest, FormSubmitAfterNavigateInPage) { |
| true); // The post-navigation layout. |
| ASSERT_FALSE(NULL == form_to_save.get()); |
| - EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); |
| + EXPECT_CALL(*store_, AddLogin(FormMatches(form))); |
| // Simulate saving the form, as if the info bar was accepted. |
| form_to_save->Save(); |
| @@ -453,10 +455,10 @@ TEST_F(PasswordManagerTest, FormSubmitAfterNavigateInPage) { |
| // This test verifies a fix for http://crbug.com/236673 |
| TEST_F(PasswordManagerTest, FormSubmitWithFormOnPreviousPage) { |
| - std::vector<PasswordForm*> result; // Empty password store. |
| + ScopedVector<PasswordForm> result; // Empty password store. |
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) |
| - .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| + .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| PasswordForm first_form(MakeSimpleForm()); |
| first_form.origin = GURL("http://www.nytimes.com/"); |
| first_form.action = GURL("https://myaccount.nytimes.com/auth/login"); |
| @@ -495,17 +497,17 @@ 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_.get(), AddLogin(FormMatches(second_form))); |
| + EXPECT_CALL(*store_, AddLogin(FormMatches(second_form))); |
| // Simulate saving the form, as if the info bar was accepted. |
| form_to_save->Save(); |
| } |
| TEST_F(PasswordManagerTest, FormSubmitFailedLogin) { |
| - std::vector<PasswordForm*> result; // Empty password store. |
| + ScopedVector<PasswordForm> result; // Empty password store. |
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) |
| - .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| + .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| std::vector<PasswordForm> observed; |
| PasswordForm form(MakeSimpleForm()); |
| observed.push_back(form); |
| @@ -524,10 +526,10 @@ TEST_F(PasswordManagerTest, FormSubmitFailedLogin) { |
| TEST_F(PasswordManagerTest, FormSubmitInvisibleLogin) { |
| // Tests fix of issue 28911: if the login form reappears on the subsequent |
| // page, but is invisible, it shouldn't count as a failed login. |
| - std::vector<PasswordForm*> result; // Empty password store. |
| + ScopedVector<PasswordForm> result; // Empty password store. |
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) |
| - .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| + .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| std::vector<PasswordForm> observed; |
| PasswordForm form(MakeSimpleForm()); |
| observed.push_back(form); |
| @@ -548,7 +550,7 @@ TEST_F(PasswordManagerTest, FormSubmitInvisibleLogin) { |
| manager()->OnPasswordFormsRendered(&driver_, observed, true); |
| ASSERT_TRUE(form_to_save.get()); |
| - EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); |
| + EXPECT_CALL(*store_, AddLogin(FormMatches(form))); |
| // Simulate saving the form. |
| form_to_save->Save(); |
| @@ -556,12 +558,11 @@ TEST_F(PasswordManagerTest, FormSubmitInvisibleLogin) { |
| TEST_F(PasswordManagerTest, InitiallyInvisibleForm) { |
| // Make sure an invisible login form still gets autofilled. |
| - std::vector<PasswordForm*> result; |
| - PasswordForm* existing = new PasswordForm(MakeSimpleForm()); |
| - result.push_back(existing); |
| + ScopedVector<PasswordForm> result; |
| + result.push_back(new PasswordForm(MakeSimpleForm())); |
| EXPECT_CALL(driver_, FillPasswordForm(_)); |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) |
| - .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| + .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| std::vector<PasswordForm> observed; |
| PasswordForm form(MakeSimpleForm()); |
| observed.push_back(form); |
| @@ -590,15 +591,14 @@ TEST_F(PasswordManagerTest, SavingDependsOnManagerEnabledPreference) { |
| TEST_F(PasswordManagerTest, FillPasswordsOnDisabledManager) { |
| // Test fix for issue 158296: Passwords must be filled even if the password |
| // manager is disabled. |
| - std::vector<PasswordForm*> result; |
| - PasswordForm* existing = new PasswordForm(MakeSimpleForm()); |
| - result.push_back(existing); |
| + ScopedVector<PasswordForm> result; |
| + result.push_back(new PasswordForm(MakeSimpleForm())); |
| prefs_.SetUserPref(prefs::kPasswordManagerSavingEnabled, |
| new base::FundamentalValue(false)); |
| EXPECT_CALL(driver_, FillPasswordForm(_)); |
| - EXPECT_CALL(*store_.get(), |
| + EXPECT_CALL(*store_, |
| GetLogins(_, testing::Eq(PasswordStore::DISALLOW_PROMPT), _)) |
| - .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| std::vector<PasswordForm> observed; |
| PasswordForm form(MakeSimpleForm()); |
| observed.push_back(form); |
| @@ -608,10 +608,10 @@ TEST_F(PasswordManagerTest, FillPasswordsOnDisabledManager) { |
| TEST_F(PasswordManagerTest, FormSavedWithAutocompleteOff) { |
| // Test password form with non-generated password will be saved even if |
| // autocomplete=off. |
| - std::vector<PasswordForm*> result; // Empty password store. |
| + ScopedVector<PasswordForm> result; // Empty password store. |
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) |
| - .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| + .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| std::vector<PasswordForm> observed; |
| PasswordForm form(MakeSimpleForm()); |
| form.password_autocomplete_set = false; |
| @@ -628,7 +628,7 @@ TEST_F(PasswordManagerTest, FormSavedWithAutocompleteOff) { |
| EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) |
| .Times(Exactly(1)) |
| .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); |
| - EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))).Times(Exactly(0)); |
| + EXPECT_CALL(*store_, AddLogin(FormMatches(form))).Times(Exactly(0)); |
| // Now the password manager waits for the navigation to complete. |
| observed.clear(); |
| @@ -643,10 +643,10 @@ TEST_F(PasswordManagerTest, FormSavedWithAutocompleteOff) { |
| TEST_F(PasswordManagerTest, GeneratedPasswordFormSavedAutocompleteOff) { |
| // Test password form with generated password will still be saved if |
| // autocomplete=off. |
| - std::vector<PasswordForm*> result; // Empty password store. |
| + ScopedVector<PasswordForm> result; // Empty password store. |
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) |
| - .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| + .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| std::vector<PasswordForm> observed; |
| PasswordForm form(MakeSimpleForm()); |
| form.password_autocomplete_set = false; |
| @@ -664,7 +664,7 @@ TEST_F(PasswordManagerTest, GeneratedPasswordFormSavedAutocompleteOff) { |
| // navigation occurs. The client will be informed that automatic saving has |
| // occured. |
| EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(Exactly(0)); |
| - EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); |
| + EXPECT_CALL(*store_, AddLogin(FormMatches(form))); |
| scoped_ptr<PasswordFormManager> saved_form_manager; |
| EXPECT_CALL(client_, AutomaticPasswordSavePtr(_)) |
| .Times(Exactly(1)) |
| @@ -690,10 +690,10 @@ TEST_F(PasswordManagerTest, PasswordFormReappearance) { |
| // We assume that if we send our credentials and there |
| // is at least one visible password form in the next page that |
| // means that our previous login attempt failed. |
| - std::vector<PasswordForm*> result; // Empty password store. |
| + ScopedVector<PasswordForm> result; // Empty password store. |
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(0); |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) |
| - .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| + .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| std::vector<PasswordForm> observed; |
| PasswordForm login_form(MakeTwitterLoginForm()); |
| observed.push_back(login_form); |
| @@ -730,7 +730,7 @@ TEST_F(PasswordManagerTest, AutofillingNotEnabledOnSSLErrors) { |
| // Feed those forms to |manager()| and check that it does not try to find |
| // matching saved credentials for the forms. |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)).Times(Exactly(0)); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)).Times(Exactly(0)); |
| manager()->OnPasswordFormsParsed(&driver_, forms); |
| } |
| @@ -750,7 +750,7 @@ TEST_F(PasswordManagerTest, AutofillingDisabledIfManagerDisabled) { |
| // Feed those forms to |manager()| and check that it does not try to find |
| // matching saved credentials for the forms. |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)).Times(Exactly(0)); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)).Times(Exactly(0)); |
| manager()->OnPasswordFormsParsed(&driver_, forms); |
| } |
| @@ -759,10 +759,10 @@ TEST_F(PasswordManagerTest, SyncCredentialsNotSaved) { |
| .WillRepeatedly(Return(true)); |
| // Simulate loading a simple form with no existing stored password. |
| - std::vector<PasswordForm*> result; // Empty password store. |
| + ScopedVector<PasswordForm> result; // Empty password store. |
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) |
| - .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| + .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| std::vector<PasswordForm> observed; |
| PasswordForm form(MakeSimpleForm()); |
| form.password_autocomplete_set = false; |
| @@ -773,7 +773,7 @@ TEST_F(PasswordManagerTest, SyncCredentialsNotSaved) { |
| // User should not be prompted and password should not be saved. |
| EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(Exactly(0)); |
| - EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))).Times(Exactly(0)); |
| + EXPECT_CALL(*store_, AddLogin(FormMatches(form))).Times(Exactly(0)); |
| // Submit form and finish navigation. |
| manager()->ProvisionallySavePassword(form); |
| @@ -788,10 +788,10 @@ TEST_F(PasswordManagerTest, SyncCredentialsNotSaved) { |
| // failure. |
| TEST_F(PasswordManagerTest, |
| SeeingFormActionWithOnlyHttpHttpsChangeIsLoginFailure) { |
| - std::vector<PasswordForm*> result; // Empty password store. |
| + ScopedVector<PasswordForm> result; // Empty password store. |
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) |
| - .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| + .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| PasswordForm first_form(MakeSimpleForm()); |
| first_form.origin = GURL("http://www.xda-developers.com/"); |
| @@ -850,10 +850,10 @@ TEST_F(PasswordManagerTest, FormSubmitWithOnlyPassowrdField) { |
| // Test to verify that on submitting the HTML password form without having |
| // username input filed shows password save promt and saves the password to |
| // store. |
| - std::vector<PasswordForm*> result; // Empty password store. |
| + ScopedVector<PasswordForm> result; // Empty password store. |
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) |
| - .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| + .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| std::vector<PasswordForm> observed; |
| // Loads passsword form without username input field. |
| @@ -878,7 +878,7 @@ TEST_F(PasswordManagerTest, FormSubmitWithOnlyPassowrdField) { |
| true); // The post-navigation layout. |
| ASSERT_TRUE(form_to_save.get()); |
| - EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); |
| + EXPECT_CALL(*store_, AddLogin(FormMatches(form))); |
| // Simulate saving the form, as if the info bar was accepted. |
| form_to_save->Save(); |
| @@ -890,11 +890,11 @@ TEST_F(PasswordManagerTest, FillPasswordOnManyFrames) { |
| PasswordForm form(MakeSimpleForm()); // The observed and saved form. |
| // "Save" the form. |
| - std::vector<PasswordForm*> result; |
| - result.push_back(new PasswordForm(form)); // Calee owns the form. |
| - EXPECT_CALL(*store_.get(), |
| + ScopedVector<PasswordForm> result; |
| + result.push_back(new PasswordForm(form)); |
| + EXPECT_CALL(*store_, |
| GetLogins(_, testing::Eq(PasswordStore::DISALLOW_PROMPT), _)) |
| - .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| // The form will be seen the first time. |
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(1); |
| @@ -913,10 +913,10 @@ TEST_F(PasswordManagerTest, FillPasswordOnManyFrames) { |
| TEST_F(PasswordManagerTest, InPageNavigation) { |
| // Test that observing a newly submitted form shows the save password bar on |
| // call in page navigation. |
| - std::vector<PasswordForm*> result; // Empty password store. |
| + ScopedVector<PasswordForm> result; // Empty password store. |
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| - EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) |
| - .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); |
| + EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| + .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
|
vasilii
2015/02/05 19:23:27
The file is full of these calls. It seems that it'
vabr (Chromium)
2015/02/06 14:16:05
Great idea!
Done.
vasilii
2015/02/09 10:08:34
I don't see it's done.
vabr (Chromium)
2015/02/09 11:36:06
Sorry, I focussed on adding the empty consumer act
|
| std::vector<PasswordForm> observed; |
| PasswordForm form(MakeSimpleForm()); |
| observed.push_back(form); |