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 #import "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h
" | 5 #import "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h
" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 class MockPasswordGenerationPopupController | 22 class MockPasswordGenerationPopupController |
23 : public autofill::PasswordGenerationPopupController { | 23 : public autofill::PasswordGenerationPopupController { |
24 public: | 24 public: |
25 MockPasswordGenerationPopupController() | 25 MockPasswordGenerationPopupController() |
26 : help_text_(base::ASCIIToUTF16("Help me if you can I'm feeling dooown")), | 26 : help_text_(base::ASCIIToUTF16("Help me if you can I'm feeling dooown")), |
27 popup_bounds_(gfx::Rect(0, 0, 200, 100)) {} | 27 popup_bounds_(gfx::Rect(0, 0, 200, 100)) {} |
28 | 28 |
29 MOCK_METHOD0(PasswordAccepted, void()); | 29 MOCK_METHOD0(PasswordAccepted, void()); |
30 | 30 |
31 virtual void OnSavedPasswordsLinkClicked() override {} | 31 void OnSavedPasswordsLinkClicked() override {} |
32 | 32 |
33 virtual int GetMinimumWidth() override { return 200; } | 33 int GetMinimumWidth() override { return 200; } |
34 | 34 |
35 virtual bool display_password() const override { return true; } | 35 bool display_password() const override { return true; } |
36 | 36 |
37 virtual bool password_selected() const override { return false; } | 37 bool password_selected() const override { return false; } |
38 | 38 |
39 MOCK_CONST_METHOD0(password, base::string16()); | 39 MOCK_CONST_METHOD0(password, base::string16()); |
40 | 40 |
41 virtual base::string16 SuggestedText() override { | 41 base::string16 SuggestedText() override { |
42 return base::ASCIIToUTF16("Suggested by Chrome"); | 42 return base::ASCIIToUTF16("Suggested by Chrome"); |
43 } | 43 } |
44 | 44 |
45 virtual const base::string16& HelpText() override { return help_text_; } | 45 const base::string16& HelpText() override { return help_text_; } |
46 | 46 |
47 virtual const gfx::Range& HelpTextLinkRange() override { return link_range_; } | 47 const gfx::Range& HelpTextLinkRange() override { return link_range_; } |
48 | 48 |
49 // AutofillPopupViewDelegate implementation. | 49 // AutofillPopupViewDelegate implementation. |
50 virtual void Hide() override {} | 50 void Hide() override {} |
51 MOCK_METHOD0(ViewDestroyed, void()); | 51 MOCK_METHOD0(ViewDestroyed, void()); |
52 virtual void SetSelectionAtPoint(const gfx::Point&) override {} | 52 void SetSelectionAtPoint(const gfx::Point&) override {} |
53 virtual bool AcceptSelectedLine() override { return true; } | 53 bool AcceptSelectedLine() override { return true; } |
54 virtual void SelectionCleared() override {} | 54 void SelectionCleared() override {} |
55 virtual const gfx::Rect& popup_bounds() const override { | 55 const gfx::Rect& popup_bounds() const override { |
56 return popup_bounds_; | 56 return popup_bounds_; |
57 } | 57 } |
58 MOCK_METHOD0(container_view, gfx::NativeView()); | 58 MOCK_METHOD0(container_view, gfx::NativeView()); |
59 MOCK_CONST_METHOD0(element_bounds, gfx::RectF&()); | 59 MOCK_CONST_METHOD0(element_bounds, gfx::RectF&()); |
60 MOCK_CONST_METHOD0(IsRTL, bool()); | 60 MOCK_CONST_METHOD0(IsRTL, bool()); |
61 | 61 |
62 private: | 62 private: |
63 base::string16 help_text_; | 63 base::string16 help_text_; |
64 gfx::Range link_range_; | 64 gfx::Range link_range_; |
65 | 65 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // popup is hidden. | 114 // popup is hidden. |
115 TEST_F(PasswordGenerationPopupViewCocoaTest, ControllerDestroyed) { | 115 TEST_F(PasswordGenerationPopupViewCocoaTest, ControllerDestroyed) { |
116 [view_ showPopup]; | 116 [view_ showPopup]; |
117 mock_controller_.reset(); | 117 mock_controller_.reset(); |
118 [view_ controllerDestroyed]; | 118 [view_ controllerDestroyed]; |
119 [view_ display]; | 119 [view_ display]; |
120 [view_ hidePopup]; | 120 [view_ hidePopup]; |
121 } | 121 } |
122 | 122 |
123 } // namespace | 123 } // namespace |
OLD | NEW |