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 "content/public/browser/web_contents.h" | 7 #include "content/public/browser/web_contents.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
8 | 9 |
9 ManagePasswordsUIControllerMock::ManagePasswordsUIControllerMock( | 10 ManagePasswordsUIControllerMock::ManagePasswordsUIControllerMock( |
10 content::WebContents* contents) | 11 content::WebContents* contents) |
11 : ManagePasswordsUIController(contents), | 12 : ManagePasswordsUIController(contents), |
12 navigated_to_settings_page_(false), | 13 navigated_to_settings_page_(false), |
13 saved_password_(false), | 14 saved_password_(false), |
14 never_saved_password_(false) { | 15 never_saved_password_(false), |
| 16 choose_credential_(false) { |
15 contents->SetUserData(UserDataKey(), this); | 17 contents->SetUserData(UserDataKey(), this); |
16 } | 18 } |
17 | 19 |
18 ManagePasswordsUIControllerMock:: | 20 ManagePasswordsUIControllerMock:: |
19 ~ManagePasswordsUIControllerMock() {} | 21 ~ManagePasswordsUIControllerMock() {} |
20 | 22 |
21 void ManagePasswordsUIControllerMock:: | 23 void ManagePasswordsUIControllerMock:: |
22 NavigateToPasswordManagerSettingsPage() { | 24 NavigateToPasswordManagerSettingsPage() { |
23 navigated_to_settings_page_ = true; | 25 navigated_to_settings_page_ = true; |
24 } | 26 } |
25 | 27 |
26 const autofill::PasswordForm& | 28 const autofill::PasswordForm& |
27 ManagePasswordsUIControllerMock::PendingCredentials() const { | 29 ManagePasswordsUIControllerMock::PendingPassword() const { |
28 return pending_credentials_; | 30 return pending_password_; |
29 } | 31 } |
30 | 32 |
31 void ManagePasswordsUIControllerMock::SetPendingCredentials( | 33 void ManagePasswordsUIControllerMock::SetPendingPassword( |
32 autofill::PasswordForm pending_credentials) { | 34 autofill::PasswordForm pending_password) { |
33 pending_credentials_ = pending_credentials; | 35 pending_password_ = pending_password; |
| 36 } |
| 37 |
| 38 void ManagePasswordsUIControllerMock::UpdateBubbleAndIconVisibility() { |
| 39 ManagePasswordsUIController::UpdateBubbleAndIconVisibility(); |
| 40 OnBubbleShown(); |
34 } | 41 } |
35 | 42 |
36 bool ManagePasswordsUIControllerMock::IsInstalled() const { | 43 bool ManagePasswordsUIControllerMock::IsInstalled() const { |
37 return web_contents()->GetUserData(UserDataKey()) == this; | 44 return web_contents()->GetUserData(UserDataKey()) == this; |
38 } | 45 } |
39 | 46 |
40 void ManagePasswordsUIControllerMock::SavePasswordInternal() { | 47 void ManagePasswordsUIControllerMock::SavePasswordInternal() { |
41 saved_password_ = true; | 48 saved_password_ = true; |
42 } | 49 } |
43 | 50 |
44 void ManagePasswordsUIControllerMock::NeverSavePasswordInternal() { | 51 void ManagePasswordsUIControllerMock::NeverSavePasswordInternal() { |
45 never_saved_password_ = true; | 52 never_saved_password_ = true; |
46 } | 53 } |
| 54 |
| 55 void ManagePasswordsUIControllerMock::ChooseCredential( |
| 56 bool was_chosen, |
| 57 const autofill::PasswordForm& form) { |
| 58 EXPECT_FALSE(choose_credential_); |
| 59 choose_credential_ = true; |
| 60 } |
OLD | NEW |