| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h" | 5 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h" |
| 6 | 6 |
| 7 #include "components/password_manager/core/browser/password_form_manager.h" | 7 #include "components/password_manager/core/browser/password_form_manager.h" |
| 8 #include "components/password_manager/core/common/credential_manager_types.h" | 8 #include "components/password_manager/core/common/credential_manager_types.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 ManagePasswordsUIControllerMock::ManagePasswordsUIControllerMock( | 12 ManagePasswordsUIControllerMock::ManagePasswordsUIControllerMock( |
| 13 content::WebContents* contents) | 13 content::WebContents* contents) |
| 14 : ManagePasswordsUIController(contents), | 14 : ManagePasswordsUIController(contents), |
| 15 navigated_to_settings_page_(false), | 15 navigated_to_settings_page_(false), |
| 16 saved_password_(false), | 16 saved_password_(false), |
| 17 updated_password_(false), |
| 17 never_saved_password_(false), | 18 never_saved_password_(false), |
| 18 unblacklist_site_(false), | 19 unblacklist_site_(false), |
| 19 choose_credential_(false), | 20 choose_credential_(false), |
| 20 manage_accounts_(false) { | 21 manage_accounts_(false) { |
| 21 // Do not silently replace an existing ManagePasswordsUIController because it | 22 // Do not silently replace an existing ManagePasswordsUIController because it |
| 22 // unregisters itself in WebContentsDestroyed(). | 23 // unregisters itself in WebContentsDestroyed(). |
| 23 EXPECT_FALSE(contents->GetUserData(UserDataKey())); | 24 EXPECT_FALSE(contents->GetUserData(UserDataKey())); |
| 24 contents->SetUserData(UserDataKey(), this); | 25 contents->SetUserData(UserDataKey(), this); |
| 25 set_client(&client_); | 26 set_client(&client_); |
| 26 } | 27 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 53 | 54 |
| 54 void ManagePasswordsUIControllerMock:: | 55 void ManagePasswordsUIControllerMock:: |
| 55 UpdateAndroidAccountChooserInfoBarVisibility() { | 56 UpdateAndroidAccountChooserInfoBarVisibility() { |
| 56 OnBubbleShown(); | 57 OnBubbleShown(); |
| 57 } | 58 } |
| 58 | 59 |
| 59 void ManagePasswordsUIControllerMock::SavePassword() { | 60 void ManagePasswordsUIControllerMock::SavePassword() { |
| 60 saved_password_ = true; | 61 saved_password_ = true; |
| 61 } | 62 } |
| 62 | 63 |
| 64 void ManagePasswordsUIControllerMock::UpdatePassword( |
| 65 const autofill::PasswordForm& password_form) { |
| 66 updated_password_ = true; |
| 67 } |
| 63 void ManagePasswordsUIControllerMock::NeverSavePassword() { | 68 void ManagePasswordsUIControllerMock::NeverSavePassword() { |
| 64 never_saved_password_ = true; | 69 never_saved_password_ = true; |
| 65 } | 70 } |
| 66 | 71 |
| 67 void ManagePasswordsUIControllerMock::UnblacklistSite() { | 72 void ManagePasswordsUIControllerMock::UnblacklistSite() { |
| 68 unblacklist_site_ = true; | 73 unblacklist_site_ = true; |
| 69 } | 74 } |
| 70 | 75 |
| 71 void ManagePasswordsUIControllerMock::ChooseCredential( | 76 void ManagePasswordsUIControllerMock::ChooseCredential( |
| 72 const autofill::PasswordForm& form, | 77 const autofill::PasswordForm& form, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 93 ScopedVector<autofill::PasswordForm> best_matches) { | 98 ScopedVector<autofill::PasswordForm> best_matches) { |
| 94 scoped_ptr<password_manager::PasswordFormManager> test_form_manager( | 99 scoped_ptr<password_manager::PasswordFormManager> test_form_manager( |
| 95 new password_manager::PasswordFormManager( | 100 new password_manager::PasswordFormManager( |
| 96 nullptr, client, | 101 nullptr, client, |
| 97 base::WeakPtr<password_manager::PasswordManagerDriver>(), | 102 base::WeakPtr<password_manager::PasswordManagerDriver>(), |
| 98 observed_form, true)); | 103 observed_form, true)); |
| 99 test_form_manager->SimulateFetchMatchingLoginsFromPasswordStore(); | 104 test_form_manager->SimulateFetchMatchingLoginsFromPasswordStore(); |
| 100 test_form_manager->OnGetPasswordStoreResults(best_matches.Pass()); | 105 test_form_manager->OnGetPasswordStoreResults(best_matches.Pass()); |
| 101 return test_form_manager.Pass(); | 106 return test_form_manager.Pass(); |
| 102 } | 107 } |
| OLD | NEW |