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/content/common/credential_manager_types.h" | 7 #include "components/password_manager/content/common/credential_manager_types.h" |
8 #include "components/password_manager/core/browser/password_form_manager.h" | 8 #include "components/password_manager/core/browser/password_form_manager.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 never_saved_password_(false), | 17 never_saved_password_(false), |
18 unblacklist_site_(false), | 18 unblacklist_site_(false), |
19 choose_credential_(false) { | 19 choose_credential_(false), |
| 20 manage_accounts_(false) { |
20 // Do not silently replace an existing ManagePasswordsUIController because it | 21 // Do not silently replace an existing ManagePasswordsUIController because it |
21 // unregisters itself in WebContentsDestroyed(). | 22 // unregisters itself in WebContentsDestroyed(). |
22 EXPECT_FALSE(contents->GetUserData(UserDataKey())); | 23 EXPECT_FALSE(contents->GetUserData(UserDataKey())); |
23 contents->SetUserData(UserDataKey(), this); | 24 contents->SetUserData(UserDataKey(), this); |
24 set_client(&client_); | 25 set_client(&client_); |
25 } | 26 } |
26 | 27 |
27 ManagePasswordsUIControllerMock:: | 28 ManagePasswordsUIControllerMock:: |
28 ~ManagePasswordsUIControllerMock() {} | 29 ~ManagePasswordsUIControllerMock() {} |
29 | 30 |
30 void ManagePasswordsUIControllerMock:: | 31 void ManagePasswordsUIControllerMock:: |
31 NavigateToPasswordManagerSettingsPage() { | 32 NavigateToPasswordManagerSettingsPage() { |
32 navigated_to_settings_page_ = true; | 33 navigated_to_settings_page_ = true; |
33 } | 34 } |
34 | 35 |
35 const autofill::PasswordForm& | 36 const autofill::PasswordForm& |
36 ManagePasswordsUIControllerMock::PendingPassword() const { | 37 ManagePasswordsUIControllerMock::PendingPassword() const { |
37 return pending_password_; | 38 return pending_password_; |
38 } | 39 } |
39 | 40 |
40 void ManagePasswordsUIControllerMock::SetPendingPassword( | 41 void ManagePasswordsUIControllerMock::SetPendingPassword( |
41 autofill::PasswordForm pending_password) { | 42 autofill::PasswordForm pending_password) { |
42 pending_password_ = pending_password; | 43 pending_password_ = pending_password; |
43 } | 44 } |
44 | 45 |
| 46 void ManagePasswordsUIControllerMock::ManageAccounts() { |
| 47 manage_accounts_ = true; |
| 48 } |
| 49 |
45 void ManagePasswordsUIControllerMock::UpdateBubbleAndIconVisibility() { | 50 void ManagePasswordsUIControllerMock::UpdateBubbleAndIconVisibility() { |
46 OnBubbleShown(); | 51 OnBubbleShown(); |
47 } | 52 } |
48 | 53 |
49 void ManagePasswordsUIControllerMock:: | 54 void ManagePasswordsUIControllerMock:: |
50 UpdateAndroidAccountChooserInfoBarVisibility() { | 55 UpdateAndroidAccountChooserInfoBarVisibility() { |
51 OnBubbleShown(); | 56 OnBubbleShown(); |
52 } | 57 } |
53 | 58 |
54 void ManagePasswordsUIControllerMock::SavePassword() { | 59 void ManagePasswordsUIControllerMock::SavePassword() { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 ScopedVector<autofill::PasswordForm> best_matches) { | 93 ScopedVector<autofill::PasswordForm> best_matches) { |
89 scoped_ptr<password_manager::PasswordFormManager> test_form_manager( | 94 scoped_ptr<password_manager::PasswordFormManager> test_form_manager( |
90 new password_manager::PasswordFormManager( | 95 new password_manager::PasswordFormManager( |
91 nullptr, client, | 96 nullptr, client, |
92 base::WeakPtr<password_manager::PasswordManagerDriver>(), | 97 base::WeakPtr<password_manager::PasswordManagerDriver>(), |
93 observed_form, true)); | 98 observed_form, true)); |
94 test_form_manager->SimulateFetchMatchingLoginsFromPasswordStore(); | 99 test_form_manager->SimulateFetchMatchingLoginsFromPasswordStore(); |
95 test_form_manager->OnGetPasswordStoreResults(best_matches.Pass()); | 100 test_form_manager->OnGetPasswordStoreResults(best_matches.Pass()); |
96 return test_form_manager.Pass(); | 101 return test_form_manager.Pass(); |
97 } | 102 } |
OLD | NEW |