| 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" |
| 36 | 37 |
| 37 namespace ash { | 38 namespace ash { |
| 38 | 39 |
| 39 class DockedWindowLayoutManagerTest | 40 class DockedWindowLayoutManagerTest |
| 40 : public test::AshTestBase, | 41 : public test::AshTestBase, |
| 41 public testing::WithParamInterface<ui::wm::WindowType> { | 42 public testing::WithParamInterface<ui::wm::WindowType> { |
| 42 public: | 43 public: |
| 43 DockedWindowLayoutManagerTest() : window_type_(GetParam()) {} | 44 DockedWindowLayoutManagerTest() : window_type_(GetParam()) {} |
| 44 virtual ~DockedWindowLayoutManagerTest() {} | 45 virtual ~DockedWindowLayoutManagerTest() {} |
| 45 | 46 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 void DragVerticallyAndRelativeToEdge(DockedEdge edge, | 182 void DragVerticallyAndRelativeToEdge(DockedEdge edge, |
| 182 aura::Window* window, | 183 aura::Window* window, |
| 183 int dx, int dy) { | 184 int dx, int dy) { |
| 184 gfx::Rect initial_bounds = window->GetBoundsInScreen(); | 185 gfx::Rect initial_bounds = window->GetBoundsInScreen(); |
| 185 // avoid snap by clicking away from the border | 186 // avoid snap by clicking away from the border |
| 186 ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(window, 25, 5)); | 187 ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(window, 25, 5)); |
| 187 | 188 |
| 188 gfx::Rect work_area = | 189 gfx::Rect work_area = |
| 189 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); | 190 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); |
| 190 gfx::Point initial_location_in_screen = initial_location_in_parent_; | 191 gfx::Point initial_location_in_screen = initial_location_in_parent_; |
| 191 wm::ConvertPointToScreen(window->parent(), &initial_location_in_screen); | 192 ::wm::ConvertPointToScreen(window->parent(), &initial_location_in_screen); |
| 192 // Drag the window left or right to the edge (or almost to it). | 193 // Drag the window left or right to the edge (or almost to it). |
| 193 if (edge == DOCKED_EDGE_LEFT) | 194 if (edge == DOCKED_EDGE_LEFT) |
| 194 dx += work_area.x() - initial_location_in_screen.x(); | 195 dx += work_area.x() - initial_location_in_screen.x(); |
| 195 else if (edge == DOCKED_EDGE_RIGHT) | 196 else if (edge == DOCKED_EDGE_RIGHT) |
| 196 dx += work_area.right() - 1 - initial_location_in_screen.x(); | 197 dx += work_area.right() - 1 - initial_location_in_screen.x(); |
| 197 DragMove(dx, dy); | 198 DragMove(dx, dy); |
| 198 EXPECT_EQ(CorrectContainerIdDuringDrag(), window->parent()->id()); | 199 EXPECT_EQ(CorrectContainerIdDuringDrag(), window->parent()->id()); |
| 199 // Release the mouse and the panel should be attached to the dock. | 200 // Release the mouse and the panel should be attached to the dock. |
| 200 DragEnd(); | 201 DragEnd(); |
| 201 | 202 |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height()); | 831 EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height()); |
| 831 } | 832 } |
| 832 | 833 |
| 833 // Tests run twice - on both panels and normal windows | 834 // Tests run twice - on both panels and normal windows |
| 834 INSTANTIATE_TEST_CASE_P(NormalOrPanel, | 835 INSTANTIATE_TEST_CASE_P(NormalOrPanel, |
| 835 DockedWindowLayoutManagerTest, | 836 DockedWindowLayoutManagerTest, |
| 836 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 837 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
| 837 ui::wm::WINDOW_TYPE_PANEL)); | 838 ui::wm::WINDOW_TYPE_PANEL)); |
| 838 | 839 |
| 839 } // namespace ash | 840 } // namespace ash |
| OLD | NEW |