Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // This mock is used in tests to ensure that we're just testing the controller 17 // 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 18 // behavior, and not the behavior of the bits and pieces it relies upon (like
19 // FormManager). 19 // FormManager).
20 class ManagePasswordsUIControllerMock 20 class ManagePasswordsUIControllerMock
21 : public ManagePasswordsUIController { 21 : public ManagePasswordsUIController {
22 public: 22 public:
23 explicit ManagePasswordsUIControllerMock( 23 explicit ManagePasswordsUIControllerMock(
24 content::WebContents* contents); 24 content::WebContents* contents);
25 virtual ~ManagePasswordsUIControllerMock(); 25 ~ManagePasswordsUIControllerMock() override;
26 26
27 // Navigation, surprisingly, is platform-specific; Android's settings page 27 // Navigation, surprisingly, is platform-specific; Android's settings page
28 // is native UI and therefore isn't available in a tab for unit tests. 28 // is native UI and therefore isn't available in a tab for unit tests.
29 // 29 //
30 // TODO(mkwst): Determine how to reasonably test this on that platform. 30 // TODO(mkwst): Determine how to reasonably test this on that platform.
31 virtual void NavigateToPasswordManagerSettingsPage() override; 31 void NavigateToPasswordManagerSettingsPage() override;
32 bool navigated_to_settings_page() const { 32 bool navigated_to_settings_page() const {
33 return navigated_to_settings_page_; 33 return navigated_to_settings_page_;
34 } 34 }
35 35
36 // We don't have a FormManager in tests, so stub these out. 36 // We don't have a FormManager in tests, so stub these out.
37 virtual void SavePasswordInternal() override; 37 void SavePasswordInternal() override;
38 bool saved_password() const { return saved_password_; } 38 bool saved_password() const { return saved_password_; }
39 39
40 virtual void NeverSavePasswordInternal() override; 40 void NeverSavePasswordInternal() override;
41 bool never_saved_password() const { return never_saved_password_; } 41 bool never_saved_password() const { return never_saved_password_; }
42 42
43 virtual const autofill::PasswordForm& PendingCredentials() const override; 43 const autofill::PasswordForm& PendingCredentials() const override;
44 void SetPendingCredentials(autofill::PasswordForm pending_credentials); 44 void SetPendingCredentials(autofill::PasswordForm pending_credentials);
45 45
46 // Sneaky setters for testing. 46 // Sneaky setters for testing.
47 void SetPasswordFormMap(const autofill::ConstPasswordFormMap& map) { 47 void SetPasswordFormMap(const autofill::ConstPasswordFormMap& map) {
48 password_form_map_ = map; 48 password_form_map_ = map;
49 } 49 }
50 void SetState(password_manager::ui::State state) { state_ = state; } 50 void SetState(password_manager::ui::State state) { state_ = state; }
51 51
52 void SetTimer(base::ElapsedTimer* timer) { timer_.reset(timer); } 52 void SetTimer(base::ElapsedTimer* timer) { timer_.reset(timer); }
53 53
54 // True if this controller is installed on |web_contents()|. 54 // True if this controller is installed on |web_contents()|.
55 bool IsInstalled() const; 55 bool IsInstalled() const;
56 56
57 using ManagePasswordsUIController::DidNavigateMainFrame; 57 using ManagePasswordsUIController::DidNavigateMainFrame;
58 58
59 private: 59 private:
60 bool navigated_to_settings_page_; 60 bool navigated_to_settings_page_;
61 bool saved_password_; 61 bool saved_password_;
62 bool never_saved_password_; 62 bool never_saved_password_;
63 63
64 autofill::PasswordForm pending_credentials_; 64 autofill::PasswordForm pending_credentials_;
65 65
66 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIControllerMock); 66 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIControllerMock);
67 }; 67 };
68 68
69 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_MOCK_H_ 69 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_MOCK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698