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 <algorithm> | 5 #include <algorithm> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "ash/aura/wm_window_aura.h" | 8 #include "ash/aura/wm_window_aura.h" |
9 #include "ash/common/accessibility_delegate.h" | 9 #include "ash/common/accessibility_delegate.h" |
10 #include "ash/common/accessibility_types.h" | 10 #include "ash/common/accessibility_types.h" |
11 #include "ash/common/ash_switches.h" | 11 #include "ash/common/ash_switches.h" |
12 #include "ash/common/shelf/shelf_widget.h" | 12 #include "ash/common/shelf/shelf_widget.h" |
13 #include "ash/common/shelf/wm_shelf.h" | 13 #include "ash/common/shelf/wm_shelf.h" |
14 #include "ash/common/system/tray/system_tray.h" | 14 #include "ash/common/system/tray/system_tray.h" |
15 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 15 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
16 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 16 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
17 #include "ash/common/wm/mru_window_tracker.h" | 17 #include "ash/common/wm/mru_window_tracker.h" |
18 #include "ash/common/wm/overview/scoped_transform_overview_window.h" | 18 #include "ash/common/wm/overview/scoped_transform_overview_window.h" |
19 #include "ash/common/wm/overview/window_grid.h" | 19 #include "ash/common/wm/overview/window_grid.h" |
20 #include "ash/common/wm/overview/window_selector.h" | 20 #include "ash/common/wm/overview/window_selector.h" |
21 #include "ash/common/wm/overview/window_selector_controller.h" | 21 #include "ash/common/wm/overview/window_selector_controller.h" |
22 #include "ash/common/wm/overview/window_selector_item.h" | 22 #include "ash/common/wm/overview/window_selector_item.h" |
23 #include "ash/common/wm/panels/panel_layout_manager.h" | 23 #include "ash/common/wm/panels/panel_layout_manager.h" |
24 #include "ash/common/wm/window_state.h" | 24 #include "ash/common/wm/window_state.h" |
25 #include "ash/common/wm/wm_event.h" | 25 #include "ash/common/wm/wm_event.h" |
| 26 #include "ash/common/wm/workspace/workspace_window_resizer.h" |
26 #include "ash/common/wm_lookup.h" | 27 #include "ash/common/wm_lookup.h" |
27 #include "ash/common/wm_shell.h" | 28 #include "ash/common/wm_shell.h" |
28 #include "ash/common/wm_window_property.h" | 29 #include "ash/common/wm_window_property.h" |
29 #include "ash/display/display_manager.h" | 30 #include "ash/display/display_manager.h" |
30 #include "ash/drag_drop/drag_drop_controller.h" | 31 #include "ash/drag_drop/drag_drop_controller.h" |
31 #include "ash/public/cpp/shell_window_ids.h" | 32 #include "ash/public/cpp/shell_window_ids.h" |
32 #include "ash/root_window_controller.h" | 33 #include "ash/root_window_controller.h" |
33 #include "ash/screen_util.h" | 34 #include "ash/screen_util.h" |
34 #include "ash/shell.h" | 35 #include "ash/shell.h" |
35 #include "ash/test/ash_test_base.h" | 36 #include "ash/test/ash_test_base.h" |
(...skipping 11 matching lines...) Expand all Loading... |
47 #include "base/strings/utf_string_conversions.h" | 48 #include "base/strings/utf_string_conversions.h" |
48 #include "base/test/user_action_tester.h" | 49 #include "base/test/user_action_tester.h" |
49 #include "base/threading/thread_task_runner_handle.h" | 50 #include "base/threading/thread_task_runner_handle.h" |
50 #include "ui/aura/client/aura_constants.h" | 51 #include "ui/aura/client/aura_constants.h" |
51 #include "ui/aura/client/cursor_client.h" | 52 #include "ui/aura/client/cursor_client.h" |
52 #include "ui/aura/client/focus_client.h" | 53 #include "ui/aura/client/focus_client.h" |
53 #include "ui/aura/test/test_window_delegate.h" | 54 #include "ui/aura/test/test_window_delegate.h" |
54 #include "ui/aura/test/test_windows.h" | 55 #include "ui/aura/test/test_windows.h" |
55 #include "ui/aura/window.h" | 56 #include "ui/aura/window.h" |
56 #include "ui/aura/window_event_dispatcher.h" | 57 #include "ui/aura/window_event_dispatcher.h" |
| 58 #include "ui/base/hit_test.h" |
57 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 59 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
58 #include "ui/display/manager/display_layout.h" | 60 #include "ui/display/manager/display_layout.h" |
59 #include "ui/events/event_utils.h" | 61 #include "ui/events/event_utils.h" |
60 #include "ui/events/test/event_generator.h" | 62 #include "ui/events/test/event_generator.h" |
61 #include "ui/gfx/animation/slide_animation.h" | 63 #include "ui/gfx/animation/slide_animation.h" |
62 #include "ui/gfx/geometry/point_conversions.h" | 64 #include "ui/gfx/geometry/point_conversions.h" |
63 #include "ui/gfx/geometry/rect_conversions.h" | 65 #include "ui/gfx/geometry/rect_conversions.h" |
64 #include "ui/gfx/geometry/safe_integer_conversions.h" | 66 #include "ui/gfx/geometry/safe_integer_conversions.h" |
65 #include "ui/gfx/transform.h" | 67 #include "ui/gfx/transform.h" |
66 #include "ui/gfx/transform_util.h" | 68 #include "ui/gfx/transform_util.h" |
(...skipping 1943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2010 transformed_rect.y() + gfx::ToCeiledInt(scale * inset) - header_height, | 2012 transformed_rect.y() + gfx::ToCeiledInt(scale * inset) - header_height, |
2011 bounds.y()); | 2013 bounds.y()); |
2012 EXPECT_LE(transformed_rect.bottom(), bounds.bottom()); | 2014 EXPECT_LE(transformed_rect.bottom(), bounds.bottom()); |
2013 EXPECT_NEAR(transformed_rect.x() - bounds.x(), | 2015 EXPECT_NEAR(transformed_rect.x() - bounds.x(), |
2014 bounds.right() - transformed_rect.right(), 1); | 2016 bounds.right() - transformed_rect.right(), 1); |
2015 EXPECT_NEAR( | 2017 EXPECT_NEAR( |
2016 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(), | 2018 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(), |
2017 bounds.bottom() - transformed_rect.bottom(), 1); | 2019 bounds.bottom() - transformed_rect.bottom(), 1); |
2018 } | 2020 } |
2019 | 2021 |
| 2022 // Start dragging a window and activate overview mode. This test should not |
| 2023 // crash or DCHECK inside aura::Window::StackChildRelativeTo(). |
| 2024 TEST_F(WindowSelectorTest, OverviewWhileDragging) { |
| 2025 const gfx::Rect bounds(10, 10, 100, 100); |
| 2026 std::unique_ptr<aura::Window> window(CreateWindow(bounds)); |
| 2027 std::unique_ptr<WindowResizer> resizer( |
| 2028 CreateWindowResizer(WmWindowAura::Get(window.get()), gfx::Point(), |
| 2029 HTCAPTION, aura::client::WINDOW_MOVE_SOURCE_MOUSE)); |
| 2030 ASSERT_TRUE(resizer.get()); |
| 2031 gfx::Point location = resizer->GetInitialLocation(); |
| 2032 location.Offset(20, 20); |
| 2033 resizer->Drag(location, 0); |
| 2034 ToggleOverview(); |
| 2035 resizer->RevertDrag(); |
| 2036 } |
| 2037 |
2020 } // namespace ash | 2038 } // namespace ash |
OLD | NEW |