| 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> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // original size. | 213 // original size. |
| 214 max_dialog_size.Enlarge(100, 100); | 214 max_dialog_size.Enlarge(100, 100); |
| 215 dialog_host()->set_max_dialog_size(max_dialog_size); | 215 dialog_host()->set_max_dialog_size(max_dialog_size); |
| 216 UpdateWebContentsModalDialogPosition(dialog(), dialog_host()); | 216 UpdateWebContentsModalDialogPosition(dialog(), dialog_host()); |
| 217 EXPECT_EQ(full_dialog_size.ToString(), GetDialogSize().ToString()); | 217 EXPECT_EQ(full_dialog_size.ToString(), GetDialogSize().ToString()); |
| 218 } | 218 } |
| 219 | 219 |
| 220 // Ensure CreateBrowserModalDialogViews() works correctly with a null parent. | 220 // Ensure CreateBrowserModalDialogViews() works correctly with a null parent. |
| 221 TEST_F(ConstrainedWindowViewsTest, NullModalParent) { | 221 TEST_F(ConstrainedWindowViewsTest, NullModalParent) { |
| 222 // Use desktop widgets (except on ChromeOS) for extra coverage. | 222 // Use desktop widgets (except on ChromeOS) for extra coverage. |
| 223 views_delegate()->set_use_desktop_native_widgets(true); | 223 test_views_delegate()->set_use_desktop_native_widgets(true); |
| 224 | 224 |
| 225 SetConstrainedWindowViewsClient( | 225 SetConstrainedWindowViewsClient( |
| 226 base::MakeUnique<TestConstrainedWindowViewsClient>()); | 226 base::MakeUnique<TestConstrainedWindowViewsClient>()); |
| 227 DialogContents* contents = new DialogContents; | 227 DialogContents* contents = new DialogContents; |
| 228 contents->set_modal_type(ui::MODAL_TYPE_WINDOW); | 228 contents->set_modal_type(ui::MODAL_TYPE_WINDOW); |
| 229 views::Widget* widget = CreateBrowserModalDialogViews(contents, nullptr); | 229 views::Widget* widget = CreateBrowserModalDialogViews(contents, nullptr); |
| 230 widget->Show(); | 230 widget->Show(); |
| 231 EXPECT_TRUE(widget->IsVisible()); | 231 EXPECT_TRUE(widget->IsVisible()); |
| 232 widget->CloseNow(); | 232 widget->CloseNow(); |
| 233 } | 233 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 260 // Now reposition the modal dialog into the display. | 260 // Now reposition the modal dialog into the display. |
| 261 UpdateWebContentsModalDialogPosition(dialog(), dialog_host()); | 261 UpdateWebContentsModalDialogPosition(dialog(), dialog_host()); |
| 262 | 262 |
| 263 const gfx::Rect dialog_bounds = dialog()->GetRootView()->GetBoundsInScreen(); | 263 const gfx::Rect dialog_bounds = dialog()->GetRootView()->GetBoundsInScreen(); |
| 264 | 264 |
| 265 // The dialog should now be fully on the display. | 265 // The dialog should now be fully on the display. |
| 266 EXPECT_TRUE(extents.Contains(dialog_bounds)); | 266 EXPECT_TRUE(extents.Contains(dialog_bounds)); |
| 267 } | 267 } |
| 268 | 268 |
| 269 } // namespace constrained_window | 269 } // namespace constrained_window |
| OLD | NEW |