OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "components/constrained_window/constrained_window_views.h" | 5 #include "components/constrained_window/constrained_window_views.h" |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 #include "base/macros.h" | 9 #include "base/macros.h" |
8 #include "components/web_modal/test_web_contents_modal_dialog_host.h" | 10 #include "components/web_modal/test_web_contents_modal_dialog_host.h" |
9 #include "ui/gfx/geometry/point.h" | 11 #include "ui/gfx/geometry/point.h" |
10 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
11 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
12 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
13 #include "ui/views/border.h" | 15 #include "ui/views/border.h" |
14 #include "ui/views/test/views_test_base.h" | 16 #include "ui/views/test/views_test_base.h" |
15 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
16 #include "ui/views/window/dialog_delegate.h" | 18 #include "ui/views/window/dialog_delegate.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 75 } |
74 | 76 |
75 DialogContents* contents() { return contents_; } | 77 DialogContents* contents() { return contents_; } |
76 web_modal::TestWebContentsModalDialogHost* dialog_host() { | 78 web_modal::TestWebContentsModalDialogHost* dialog_host() { |
77 return dialog_host_.get(); | 79 return dialog_host_.get(); |
78 } | 80 } |
79 Widget* dialog() { return dialog_; } | 81 Widget* dialog() { return dialog_; } |
80 | 82 |
81 private: | 83 private: |
82 DialogContents* contents_; | 84 DialogContents* contents_; |
83 scoped_ptr<web_modal::TestWebContentsModalDialogHost> dialog_host_; | 85 std::unique_ptr<web_modal::TestWebContentsModalDialogHost> dialog_host_; |
84 Widget* dialog_; | 86 Widget* dialog_; |
85 | 87 |
86 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowViewsTest); | 88 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowViewsTest); |
87 }; | 89 }; |
88 | 90 |
89 } // namespace | 91 } // namespace |
90 | 92 |
91 // Make sure a dialog that increases its preferred size grows on the next | 93 // Make sure a dialog that increases its preferred size grows on the next |
92 // position update. | 94 // position update. |
93 TEST_F(ConstrainedWindowViewsTest, GrowModalDialogSize) { | 95 TEST_F(ConstrainedWindowViewsTest, GrowModalDialogSize) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 148 |
147 // Increasing the maximum dialog size should bring the dialog back to its | 149 // Increasing the maximum dialog size should bring the dialog back to its |
148 // original size. | 150 // original size. |
149 max_dialog_size.Enlarge(100, 100); | 151 max_dialog_size.Enlarge(100, 100); |
150 dialog_host()->set_max_dialog_size(max_dialog_size); | 152 dialog_host()->set_max_dialog_size(max_dialog_size); |
151 UpdateWebContentsModalDialogPosition(dialog(), dialog_host()); | 153 UpdateWebContentsModalDialogPosition(dialog(), dialog_host()); |
152 EXPECT_EQ(full_dialog_size.ToString(), GetDialogSize().ToString()); | 154 EXPECT_EQ(full_dialog_size.ToString(), GetDialogSize().ToString()); |
153 } | 155 } |
154 | 156 |
155 } // namespace constrained_window | 157 } // namespace constrained_window |
OLD | NEW |