OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ash/wm/dock/docked_window_layout_manager.h" | 5 #include "ash/wm/dock/docked_window_layout_manager.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "base/basictypes.h" | 26 #include "base/basictypes.h" |
27 #include "base/command_line.h" | 27 #include "base/command_line.h" |
28 #include "base/strings/string_number_conversions.h" | 28 #include "base/strings/string_number_conversions.h" |
29 #include "ui/aura/client/aura_constants.h" | 29 #include "ui/aura/client/aura_constants.h" |
30 #include "ui/aura/test/test_window_delegate.h" | 30 #include "ui/aura/test/test_window_delegate.h" |
31 #include "ui/aura/window.h" | 31 #include "ui/aura/window.h" |
32 #include "ui/aura/window_event_dispatcher.h" | 32 #include "ui/aura/window_event_dispatcher.h" |
33 #include "ui/base/hit_test.h" | 33 #include "ui/base/hit_test.h" |
34 #include "ui/gfx/screen.h" | 34 #include "ui/gfx/screen.h" |
35 #include "ui/views/widget/widget.h" | 35 #include "ui/views/widget/widget.h" |
36 #include "ui/wm/core/coordinate_conversion.h" | |
37 | 36 |
38 namespace ash { | 37 namespace ash { |
39 | 38 |
40 class DockedWindowLayoutManagerTest | 39 class DockedWindowLayoutManagerTest |
41 : public test::AshTestBase, | 40 : public test::AshTestBase, |
42 public testing::WithParamInterface<ui::wm::WindowType> { | 41 public testing::WithParamInterface<ui::wm::WindowType> { |
43 public: | 42 public: |
44 DockedWindowLayoutManagerTest() : window_type_(GetParam()) {} | 43 DockedWindowLayoutManagerTest() : window_type_(GetParam()) {} |
45 virtual ~DockedWindowLayoutManagerTest() {} | 44 virtual ~DockedWindowLayoutManagerTest() {} |
46 | 45 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 void DragVerticallyAndRelativeToEdge(DockedEdge edge, | 181 void DragVerticallyAndRelativeToEdge(DockedEdge edge, |
183 aura::Window* window, | 182 aura::Window* window, |
184 int dx, int dy) { | 183 int dx, int dy) { |
185 gfx::Rect initial_bounds = window->GetBoundsInScreen(); | 184 gfx::Rect initial_bounds = window->GetBoundsInScreen(); |
186 // avoid snap by clicking away from the border | 185 // avoid snap by clicking away from the border |
187 ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(window, 25, 5)); | 186 ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(window, 25, 5)); |
188 | 187 |
189 gfx::Rect work_area = | 188 gfx::Rect work_area = |
190 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); | 189 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); |
191 gfx::Point initial_location_in_screen = initial_location_in_parent_; | 190 gfx::Point initial_location_in_screen = initial_location_in_parent_; |
192 ::wm::ConvertPointToScreen(window->parent(), &initial_location_in_screen); | 191 wm::ConvertPointToScreen(window->parent(), &initial_location_in_screen); |
193 // Drag the window left or right to the edge (or almost to it). | 192 // Drag the window left or right to the edge (or almost to it). |
194 if (edge == DOCKED_EDGE_LEFT) | 193 if (edge == DOCKED_EDGE_LEFT) |
195 dx += work_area.x() - initial_location_in_screen.x(); | 194 dx += work_area.x() - initial_location_in_screen.x(); |
196 else if (edge == DOCKED_EDGE_RIGHT) | 195 else if (edge == DOCKED_EDGE_RIGHT) |
197 dx += work_area.right() - 1 - initial_location_in_screen.x(); | 196 dx += work_area.right() - 1 - initial_location_in_screen.x(); |
198 DragMove(dx, dy); | 197 DragMove(dx, dy); |
199 EXPECT_EQ(CorrectContainerIdDuringDrag(), window->parent()->id()); | 198 EXPECT_EQ(CorrectContainerIdDuringDrag(), window->parent()->id()); |
200 // Release the mouse and the panel should be attached to the dock. | 199 // Release the mouse and the panel should be attached to the dock. |
201 DragEnd(); | 200 DragEnd(); |
202 | 201 |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height()); | 830 EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height()); |
832 } | 831 } |
833 | 832 |
834 // Tests run twice - on both panels and normal windows | 833 // Tests run twice - on both panels and normal windows |
835 INSTANTIATE_TEST_CASE_P(NormalOrPanel, | 834 INSTANTIATE_TEST_CASE_P(NormalOrPanel, |
836 DockedWindowLayoutManagerTest, | 835 DockedWindowLayoutManagerTest, |
837 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 836 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
838 ui::wm::WINDOW_TYPE_PANEL)); | 837 ui::wm::WINDOW_TYPE_PANEL)); |
839 | 838 |
840 } // namespace ash | 839 } // namespace ash |
OLD | NEW |