| 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 be112e534d8122a70faf9e627942e8cef3ead3c8..9c3be6a629ef4770fa44987598b8a52aa749e270 100644
|
| --- a/components/password_manager/core/browser/password_manager_unittest.cc
|
| +++ b/components/password_manager/core/browser/password_manager_unittest.cc
|
| @@ -223,6 +223,9 @@ MATCHER_P(FormMatches, form, "") {
|
| }
|
|
|
| TEST_F(PasswordManagerTest, FormSubmitEmptyStore) {
|
| + EXPECT_CALL(driver_, DidLastPageLoadEncounterSSLErrors())
|
| + .WillRepeatedly(Return(false));
|
| +
|
| // Test that observing a newly submitted form shows the save password bar.
|
| std::vector<PasswordForm*> result; // Empty password store.
|
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0));
|
| @@ -300,6 +303,9 @@ TEST_F(PasswordManagerTest, FormSubmitWithOnlyNewPasswordField) {
|
| }
|
|
|
| TEST_F(PasswordManagerTest, GeneratedPasswordFormSubmitEmptyStore) {
|
| + EXPECT_CALL(driver_, DidLastPageLoadEncounterSSLErrors())
|
| + .WillRepeatedly(Return(false));
|
| +
|
| // 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.
|
| @@ -330,6 +336,9 @@ TEST_F(PasswordManagerTest, GeneratedPasswordFormSubmitEmptyStore) {
|
| }
|
|
|
| TEST_F(PasswordManagerTest, FormSubmitNoGoodMatch) {
|
| + EXPECT_CALL(driver_, DidLastPageLoadEncounterSSLErrors())
|
| + .WillRepeatedly(Return(false));
|
| +
|
| // Same as above, except with an existing form for the same signon realm,
|
| // but different origin. Detailed cases like this are covered by
|
| // PasswordFormManagerTest.
|
| @@ -367,6 +376,9 @@ TEST_F(PasswordManagerTest, FormSubmitNoGoodMatch) {
|
| }
|
|
|
| TEST_F(PasswordManagerTest, FormSeenThenLeftPage) {
|
| + EXPECT_CALL(driver_, DidLastPageLoadEncounterSSLErrors())
|
| + .WillRepeatedly(Return(false));
|
| +
|
| std::vector<PasswordForm*> result; // Empty password store.
|
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0));
|
| EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
|
| @@ -387,6 +399,9 @@ TEST_F(PasswordManagerTest, FormSeenThenLeftPage) {
|
| }
|
|
|
| TEST_F(PasswordManagerTest, FormSubmitAfterNavigateInPage) {
|
| + EXPECT_CALL(driver_, DidLastPageLoadEncounterSSLErrors())
|
| + .WillRepeatedly(Return(false));
|
| +
|
| // Test that navigating in the page does not prevent us from showing the save
|
| // password infobar.
|
| std::vector<PasswordForm*> result; // Empty password store.
|
| @@ -424,6 +439,9 @@ TEST_F(PasswordManagerTest, FormSubmitAfterNavigateInPage) {
|
|
|
| // This test verifies a fix for http://crbug.com/236673
|
| TEST_F(PasswordManagerTest, FormSubmitWithFormOnPreviousPage) {
|
| + EXPECT_CALL(driver_, DidLastPageLoadEncounterSSLErrors())
|
| + .WillRepeatedly(Return(false));
|
| +
|
| std::vector<PasswordForm*> result; // Empty password store.
|
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0));
|
| EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
|
| @@ -473,6 +491,9 @@ TEST_F(PasswordManagerTest, FormSubmitWithFormOnPreviousPage) {
|
| }
|
|
|
| TEST_F(PasswordManagerTest, FormSubmitFailedLogin) {
|
| + EXPECT_CALL(driver_, DidLastPageLoadEncounterSSLErrors())
|
| + .WillRepeatedly(Return(false));
|
| +
|
| std::vector<PasswordForm*> result; // Empty password store.
|
| EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0));
|
| EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
|
| @@ -492,6 +513,9 @@ TEST_F(PasswordManagerTest, FormSubmitFailedLogin) {
|
| }
|
|
|
| TEST_F(PasswordManagerTest, FormSubmitInvisibleLogin) {
|
| + EXPECT_CALL(driver_, DidLastPageLoadEncounterSSLErrors())
|
| + .WillRepeatedly(Return(false));
|
| +
|
| // 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.
|
| @@ -524,6 +548,9 @@ TEST_F(PasswordManagerTest, FormSubmitInvisibleLogin) {
|
| }
|
|
|
| TEST_F(PasswordManagerTest, InitiallyInvisibleForm) {
|
| + EXPECT_CALL(driver_, DidLastPageLoadEncounterSSLErrors())
|
| + .WillRepeatedly(Return(false));
|
| +
|
| // Make sure an invisible login form still gets autofilled.
|
| std::vector<PasswordForm*> result;
|
| PasswordForm* existing = new PasswordForm(MakeSimpleForm());
|
| @@ -555,6 +582,9 @@ TEST_F(PasswordManagerTest, SavingDependsOnManagerEnabledPreference) {
|
| }
|
|
|
| TEST_F(PasswordManagerTest, FillPasswordsOnDisabledManager) {
|
| + EXPECT_CALL(driver_, DidLastPageLoadEncounterSSLErrors())
|
| + .WillRepeatedly(Return(false));
|
| +
|
| // Test fix for issue 158296: Passwords must be filled even if the password
|
| // manager is disabled.
|
| std::vector<PasswordForm*> result;
|
| @@ -573,6 +603,9 @@ TEST_F(PasswordManagerTest, FillPasswordsOnDisabledManager) {
|
| }
|
|
|
| TEST_F(PasswordManagerTest, FormSavedWithAutocompleteOff) {
|
| + EXPECT_CALL(driver_, DidLastPageLoadEncounterSSLErrors())
|
| + .WillRepeatedly(Return(false));
|
| +
|
| // Test password form with non-generated password will be saved even if
|
| // autocomplete=off.
|
| std::vector<PasswordForm*> result; // Empty password store.
|
| @@ -605,6 +638,9 @@ TEST_F(PasswordManagerTest, FormSavedWithAutocompleteOff) {
|
| }
|
|
|
| TEST_F(PasswordManagerTest, GeneratedPasswordFormSavedAutocompleteOff) {
|
| + EXPECT_CALL(driver_, DidLastPageLoadEncounterSSLErrors())
|
| + .WillRepeatedly(Return(false));
|
| +
|
| // Test password form with generated password will still be saved if
|
| // autocomplete=off.
|
| std::vector<PasswordForm*> result; // Empty password store.
|
| @@ -636,6 +672,9 @@ TEST_F(PasswordManagerTest, GeneratedPasswordFormSavedAutocompleteOff) {
|
| }
|
|
|
| TEST_F(PasswordManagerTest, SubmissionCallbackTest) {
|
| + EXPECT_CALL(driver_, DidLastPageLoadEncounterSSLErrors())
|
| + .WillRepeatedly(Return(false));
|
| +
|
| manager()->AddSubmissionCallback(SubmissionCallback());
|
| PasswordForm form = MakeSimpleForm();
|
| OnPasswordFormSubmitted(form);
|
|
|