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

Side by Side Diff: chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.h

Issue 2202373002: Ignore OnBubbleHidden() event when the password bubble is reopened. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 4 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_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 "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" 9 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
10 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" 10 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
11 #import "chrome/browser/ui/cocoa/passwords/base_passwords_content_view_controlle r.h" 11 #import "chrome/browser/ui/cocoa/passwords/base_passwords_content_view_controlle r.h"
12 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" 12 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
13 #include "chrome/browser/ui/passwords/passwords_model_delegate_mock.h"
13 14
14 namespace content { 15 namespace content {
15 class WebContents; 16 class WebContents;
16 } // namespace content 17 } // namespace content
17 18 class PasswordsModelDelegateMock;
18 class ManagePasswordsUIControllerMock;
19 class ManagePasswordsBubbleModel;
20 19
21 // Helper delegate for testing the views of the password management bubble. 20 // Helper delegate for testing the views of the password management bubble.
22 @interface ContentViewDelegateMock : NSObject<BasePasswordsContentViewDelegate> 21 @interface ContentViewDelegateMock : NSObject<BasePasswordsContentViewDelegate>
23 @property(nonatomic) ManagePasswordsBubbleModel* model; 22 @property(nonatomic) ManagePasswordsBubbleModel* model;
24 @property(readonly, nonatomic) BOOL dismissed; 23 @property(readonly, nonatomic) BOOL dismissed;
25 @end 24 @end
26 25
27 class ManagePasswordsControllerTest : public CocoaProfileTest { 26 class ManagePasswordsControllerTest : public CocoaProfileTest {
28 public: 27 public:
29 using VectorConstFormPtr = std::vector<const autofill::PasswordForm*>; 28 using VectorConstFormPtr = std::vector<const autofill::PasswordForm*>;
30 29
31 ManagePasswordsControllerTest(); 30 ManagePasswordsControllerTest();
32 ~ManagePasswordsControllerTest() override; 31 ~ManagePasswordsControllerTest() override;
33 void SetUp() override; 32 void SetUp() override;
34 33
35 ManagePasswordsUIControllerMock* ui_controller() { return ui_controller_; } 34 PasswordsModelDelegateMock* ui_controller() {
35 return ui_controller_.get();
36 }
36 ContentViewDelegateMock* delegate() { return delegate_.get(); } 37 ContentViewDelegateMock* delegate() { return delegate_.get(); }
37 ManagePasswordsBubbleModel* GetModelAndCreateIfNull(); 38 ManagePasswordsBubbleModel* GetModelAndCreateIfNull();
38 39
39 // Sets the appropriate state for ManagePasswordsBubbleModel. 40 // Sets the appropriate state for ManagePasswordsBubbleModel.
40 void SetUpSavePendingState(bool empty_username); 41 void SetUpSavePendingState(bool empty_username);
41 void SetUpUpdatePendingState(bool multiple_forms); 42 void SetUpUpdatePendingState(bool multiple_forms);
42 void SetUpConfirmationState(); 43 void SetUpConfirmationState();
43 void SetUpManageState(const VectorConstFormPtr& forms); 44 void SetUpManageState(const VectorConstFormPtr& forms);
44 45
45 // An opportunity for tests to override the constructor parameter of 46 // An opportunity for tests to override the constructor parameter of
46 // ManagePasswordsBubbleModel. 47 // ManagePasswordsBubbleModel.
47 virtual ManagePasswordsBubbleModel::DisplayReason GetDisplayReason() const; 48 virtual ManagePasswordsBubbleModel::DisplayReason GetDisplayReason() const;
48 49
49 private: 50 private:
50 ManagePasswordsUIControllerMock* ui_controller_; 51 std::unique_ptr<PasswordsModelDelegateMock> ui_controller_;
vabr (Chromium) 2016/08/05 14:14:04 nit: #include <memory> for unique_ptr
vasilii 2016/08/05 16:45:19 Done.
51 std::unique_ptr<content::WebContents> test_web_contents_; 52 std::unique_ptr<content::WebContents> test_web_contents_;
52 std::unique_ptr<ManagePasswordsBubbleModel> model_; 53 std::unique_ptr<ManagePasswordsBubbleModel> model_;
53 base::scoped_nsobject<ContentViewDelegateMock> delegate_; 54 base::scoped_nsobject<ContentViewDelegateMock> delegate_;
54 55
55 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsControllerTest); 56 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsControllerTest);
56 }; 57 };
57 58
58 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_BASE_PASSWORDS_CONTROLLER_TEST_H_ 59 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_BASE_PASSWORDS_CONTROLLER_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698