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 "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ui/aura/client/aura_constants.h" | 8 #include "ui/aura/client/aura_constants.h" |
9 #include "ui/aura/client/cursor_client.h" | 9 #include "ui/aura/client/cursor_client.h" |
10 #include "ui/aura/client/window_tree_client.h" | 10 #include "ui/aura/client/window_tree_client.h" |
11 #include "ui/aura/test/test_window_delegate.h" | 11 #include "ui/aura/test/test_window_delegate.h" |
12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
13 #include "ui/aura/window_tree_host.h" | 13 #include "ui/aura/window_tree_host.h" |
14 #include "ui/events/test/event_generator.h" | 14 #include "ui/events/test/event_generator.h" |
15 #include "ui/gfx/screen.h" | |
15 #include "ui/views/test/views_test_base.h" | 16 #include "ui/views/test/views_test_base.h" |
16 #include "ui/views/test/widget_test.h" | 17 #include "ui/views/test/widget_test.h" |
17 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
18 #include "ui/wm/public/dispatcher_client.h" | 19 #include "ui/wm/public/dispatcher_client.h" |
19 | 20 |
20 namespace views { | 21 namespace views { |
21 namespace test { | 22 namespace test { |
22 | 23 |
23 typedef ViewsTestBase DesktopNativeWidgetAuraTest; | 24 typedef ViewsTestBase DesktopNativeWidgetAuraTest; |
24 | 25 |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
387 gfx::Rect new_size(0, 0, 400, 400); | 388 gfx::Rect new_size(0, 0, 400, 400); |
388 popup_window.owned_window()->SetBounds(new_size); | 389 popup_window.owned_window()->SetBounds(new_size); |
389 | 390 |
390 EXPECT_EQ(popup_window.top_level_widget()->GetNativeView()->bounds().size(), | 391 EXPECT_EQ(popup_window.top_level_widget()->GetNativeView()->bounds().size(), |
391 new_size.size()); | 392 new_size.size()); |
392 RunPendingMessages(); | 393 RunPendingMessages(); |
393 ASSERT_NO_FATAL_FAILURE(popup_window.DestroyOwnedWindow()); | 394 ASSERT_NO_FATAL_FAILURE(popup_window.DestroyOwnedWindow()); |
394 RunPendingMessages(); | 395 RunPendingMessages(); |
395 } | 396 } |
396 | 397 |
398 // This test validates that when a top level owned popup Aura window is | |
399 // repositioned, the widget is repositioned as well. | |
400 TEST_F(DesktopAuraWidgetTest, TopLevelOwnedPopupRepositionTest) { | |
401 ViewsDelegate::views_delegate = NULL; | |
402 DesktopAuraTopLevelWindowTest popup_window; | |
403 ASSERT_NO_FATAL_FAILURE(popup_window.CreateTopLevelWindow( | |
404 gfx::Rect(0, 0, 200, 200), false)); | |
405 | |
406 gfx::Rect new_pos(10, 10, 400, 400); | |
407 popup_window.owned_window()->SetBoundsInScreen( | |
408 new_pos, | |
409 gfx::Screen::GetScreenFor( | |
410 popup_window.owned_window())->GetDisplayNearestPoint(gfx::Point())); | |
411 | |
412 EXPECT_EQ(popup_window.top_level_widget()->GetWindowBoundsInScreen(), | |
sky
2015/01/23 17:38:50
new_pos should be first (argument order is expecte
ananta
2015/01/23 19:37:11
Done.
| |
413 new_pos); | |
414 RunPendingMessages(); | |
sky
2015/01/23 17:38:50
Why the RunPendingMessages?
ananta
2015/01/23 19:37:11
Stupid cut paste. Removed the first RunPendingMess
sky
2015/01/23 20:29:21
Why do we need to wait for the destruction?
| |
415 ASSERT_NO_FATAL_FAILURE(popup_window.DestroyOwnedWindow()); | |
416 RunPendingMessages(); | |
417 } | |
418 | |
397 } // namespace test | 419 } // namespace test |
398 } // namespace views | 420 } // namespace views |
OLD | NEW |