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_COCOA_PASSWORDS_BASE_PASSWORDS_CONTROLLER_TEST_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_PASSWORDS_BASE_PASSWORDS_CONTROLLER_TEST_H_ |
6 #define CHROME_BROWSER_UI_COCOA_PASSWORDS_BASE_PASSWORDS_CONTROLLER_TEST_H_ | 6 #define CHROME_BROWSER_UI_COCOA_PASSWORDS_BASE_PASSWORDS_CONTROLLER_TEST_H_ |
7 | 7 |
8 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 8 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
9 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 9 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
10 #import "chrome/browser/ui/cocoa/passwords/base_passwords_content_view_controlle
r.h" | 10 #import "chrome/browser/ui/cocoa/passwords/base_passwords_content_view_controlle
r.h" |
11 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" | 11 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class WebContents; | 14 class WebContents; |
15 } // namespace content | 15 } // namespace content |
16 | 16 |
17 class ManagePasswordsUIControllerMock; | 17 class ManagePasswordsUIControllerMock; |
18 class ManagePasswordsBubbleModel; | 18 class ManagePasswordsBubbleModel; |
19 | 19 |
20 class ManagePasswordsControllerTest : public CocoaProfileTest { | 20 class ManagePasswordsControllerTest : public CocoaProfileTest { |
21 public: | 21 public: |
22 ManagePasswordsControllerTest(); | 22 ManagePasswordsControllerTest(); |
23 ~ManagePasswordsControllerTest() override; | 23 ~ManagePasswordsControllerTest() override; |
24 void SetUp() override; | 24 void SetUp() override; |
25 | 25 |
26 ManagePasswordsUIControllerMock* ui_controller() { return ui_controller_; } | 26 ManagePasswordsUIControllerMock* ui_controller() { return ui_controller_; } |
27 ManagePasswordsBubbleModel* GetModelAndCreateIfNull(); | 27 ManagePasswordsBubbleModel* GetModelAndCreateIfNull(); |
28 | 28 |
29 // Sets the appropriate state for ManagePasswordsBubbleModel. | 29 // Sets the appropriate state for ManagePasswordsBubbleModel. |
30 void SetUpPendingState(); | 30 void SetUpPendingState(bool update); |
31 void SetUpConfirmationState(); | 31 void SetUpConfirmationState(); |
32 void SetUpManageState(); | 32 void SetUpManageState(); |
33 void SetUpAccountChooser( | 33 void SetUpAccountChooser( |
34 ScopedVector<const autofill::PasswordForm> local, | 34 ScopedVector<const autofill::PasswordForm> local, |
35 ScopedVector<const autofill::PasswordForm> federations); | 35 ScopedVector<const autofill::PasswordForm> federations); |
36 | 36 |
37 // An opportunity for tests to override the constructor parameter of | 37 // An opportunity for tests to override the constructor parameter of |
38 // ManagePasswordsBubbleModel. | 38 // ManagePasswordsBubbleModel. |
39 virtual ManagePasswordsBubbleModel::DisplayReason GetDisplayReason() const; | 39 virtual ManagePasswordsBubbleModel::DisplayReason GetDisplayReason() const; |
40 | 40 |
41 private: | 41 private: |
42 ManagePasswordsUIControllerMock* ui_controller_; | 42 ManagePasswordsUIControllerMock* ui_controller_; |
43 scoped_ptr<content::WebContents> test_web_contents_; | 43 scoped_ptr<content::WebContents> test_web_contents_; |
44 scoped_ptr<ManagePasswordsBubbleModel> model_; | 44 scoped_ptr<ManagePasswordsBubbleModel> model_; |
45 }; | 45 }; |
46 | 46 |
47 // Helper delegate for testing the views of the password management bubble. | 47 // Helper delegate for testing the views of the password management bubble. |
48 @interface ContentViewDelegateMock | 48 @interface ContentViewDelegateMock |
49 : NSObject<ManagePasswordsBubbleContentViewDelegate> { | 49 : NSObject<ManagePasswordsBubbleContentViewDelegate> { |
50 @private | 50 @private |
51 BOOL _dismissed; | 51 BOOL _dismissed; |
52 } | 52 } |
53 @property(readonly, nonatomic) BOOL dismissed; | 53 @property(readonly, nonatomic) BOOL dismissed; |
54 @end | 54 @end |
55 | 55 |
56 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_BASE_PASSWORDS_CONTROLLER_TEST_H_ | 56 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_BASE_PASSWORDS_CONTROLLER_TEST_H_ |
OLD | NEW |