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 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_MOCK_H_ | 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_MOCK_H_ |
6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_MOCK_H_ | 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_MOCK_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 9 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
10 #include "components/password_manager/core/common/password_manager_ui.h" | 10 #include "components/password_manager/core/common/password_manager_ui.h" |
11 #include "content/public/browser/navigation_details.h" | 11 #include "content/public/browser/navigation_details.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class WebContents; | 14 class WebContents; |
15 } // namespace content | 15 } // namespace content |
16 | 16 |
| 17 namespace password_manager { |
| 18 enum class CredentialType : unsigned int; |
| 19 } |
| 20 |
17 // This mock is used in tests to ensure that we're just testing the controller | 21 // This mock is used in tests to ensure that we're just testing the controller |
18 // behavior, and not the behavior of the bits and pieces it relies upon (like | 22 // behavior, and not the behavior of the bits and pieces it relies upon (like |
19 // FormManager). | 23 // FormManager). |
20 class ManagePasswordsUIControllerMock | 24 class ManagePasswordsUIControllerMock |
21 : public ManagePasswordsUIController { | 25 : public ManagePasswordsUIController { |
22 public: | 26 public: |
23 explicit ManagePasswordsUIControllerMock( | 27 explicit ManagePasswordsUIControllerMock( |
24 content::WebContents* contents); | 28 content::WebContents* contents); |
25 ~ManagePasswordsUIControllerMock() override; | 29 ~ManagePasswordsUIControllerMock() override; |
26 | 30 |
27 // Navigation, surprisingly, is platform-specific; Android's settings page | 31 // Navigation, surprisingly, is platform-specific; Android's settings page |
28 // is native UI and therefore isn't available in a tab for unit tests. | 32 // is native UI and therefore isn't available in a tab for unit tests. |
29 // | 33 // |
30 // TODO(mkwst): Determine how to reasonably test this on that platform. | 34 // TODO(mkwst): Determine how to reasonably test this on that platform. |
31 void NavigateToPasswordManagerSettingsPage() override; | 35 void NavigateToPasswordManagerSettingsPage() override; |
32 bool navigated_to_settings_page() const { | 36 bool navigated_to_settings_page() const { |
33 return navigated_to_settings_page_; | 37 return navigated_to_settings_page_; |
34 } | 38 } |
35 | 39 |
36 // We don't have a FormManager in tests, so stub these out. | 40 // We don't have a FormManager in tests, so stub these out. |
37 void SavePasswordInternal() override; | 41 void SavePasswordInternal() override; |
38 bool saved_password() const { return saved_password_; } | 42 bool saved_password() const { return saved_password_; } |
39 | 43 |
40 void NeverSavePasswordInternal() override; | 44 void NeverSavePasswordInternal() override; |
41 bool never_saved_password() const { return never_saved_password_; } | 45 bool never_saved_password() const { return never_saved_password_; } |
42 | 46 |
43 void ChooseCredential(bool was_chosen, | 47 void ChooseCredential(const autofill::PasswordForm& form, |
44 const autofill::PasswordForm& form) override; | 48 password_manager::CredentialType form_type) override; |
45 bool choose_credential() const { return choose_credential_; } | 49 bool choose_credential() const { return choose_credential_; } |
46 | 50 |
47 const autofill::PasswordForm& PendingPassword() const override; | 51 const autofill::PasswordForm& PendingPassword() const override; |
48 void SetPendingPassword(autofill::PasswordForm pending_password); | 52 void SetPendingPassword(autofill::PasswordForm pending_password); |
49 | 53 |
50 void UpdateBubbleAndIconVisibility() override; | 54 void UpdateBubbleAndIconVisibility() override; |
51 | 55 |
52 base::TimeDelta Elapsed() const override; | 56 base::TimeDelta Elapsed() const override; |
53 | 57 |
54 // Sneaky setters for testing. | 58 // Sneaky setters for testing. |
(...skipping 15 matching lines...) Expand all Loading... |
70 bool never_saved_password_; | 74 bool never_saved_password_; |
71 bool choose_credential_; | 75 bool choose_credential_; |
72 base::TimeDelta elapsed_; | 76 base::TimeDelta elapsed_; |
73 | 77 |
74 autofill::PasswordForm pending_password_; | 78 autofill::PasswordForm pending_password_; |
75 | 79 |
76 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIControllerMock); | 80 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIControllerMock); |
77 }; | 81 }; |
78 | 82 |
79 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_MOCK_H_ | 83 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_MOCK_H_ |
OLD | NEW |