| 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/common/wm/dock/docked_window_resizer.h" | 5 #include "ash/common/wm/dock/docked_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/ash_switches.h" | 8 #include "ash/common/ash_switches.h" |
| 9 #include "ash/common/shelf/shelf_model.h" | |
| 10 #include "ash/common/shelf/shelf_types.h" | 9 #include "ash/common/shelf/shelf_types.h" |
| 11 #include "ash/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
| 12 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 11 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
| 13 #include "ash/common/wm/panels/panel_layout_manager.h" | 12 #include "ash/common/wm/panels/panel_layout_manager.h" |
| 14 #include "ash/common/wm/window_state.h" | 13 #include "ash/common/wm/window_state.h" |
| 15 #include "ash/common/wm/wm_event.h" | 14 #include "ash/common/wm/wm_event.h" |
| 16 #include "ash/common/wm_shell.h" | 15 #include "ash/common/wm_shell.h" |
| 17 #include "ash/display/window_tree_host_manager.h" | 16 #include "ash/display/window_tree_host_manager.h" |
| 18 #include "ash/root_window_controller.h" | 17 #include "ash/root_window_controller.h" |
| 19 #include "ash/screen_util.h" | 18 #include "ash/screen_util.h" |
| 20 #include "ash/shelf/shelf.h" | 19 #include "ash/shelf/shelf.h" |
| 21 #include "ash/shelf/shelf_layout_manager.h" | |
| 22 #include "ash/shelf/shelf_widget.h" | 20 #include "ash/shelf/shelf_widget.h" |
| 23 #include "ash/shell.h" | 21 #include "ash/shell.h" |
| 24 #include "ash/test/ash_test_base.h" | 22 #include "ash/test/ash_test_base.h" |
| 25 #include "ash/test/cursor_manager_test_api.h" | 23 #include "ash/test/cursor_manager_test_api.h" |
| 26 #include "ash/test/test_shelf_delegate.h" | 24 #include "ash/test/test_shelf_delegate.h" |
| 27 #include "ash/wm/drag_window_resizer.h" | 25 #include "ash/wm/drag_window_resizer.h" |
| 28 #include "ash/wm/window_state_aura.h" | 26 #include "ash/wm/window_state_aura.h" |
| 29 #include "ash/wm/window_util.h" | 27 #include "ash/wm/window_util.h" |
| 30 #include "base/command_line.h" | 28 #include "base/command_line.h" |
| 31 #include "ui/aura/client/aura_constants.h" | 29 #include "ui/aura/client/aura_constants.h" |
| 32 #include "ui/aura/client/window_tree_client.h" | 30 #include "ui/aura/client/window_tree_client.h" |
| 33 #include "ui/aura/test/test_window_delegate.h" | 31 #include "ui/aura/test/test_window_delegate.h" |
| 34 #include "ui/aura/window_event_dispatcher.h" | 32 #include "ui/aura/window_event_dispatcher.h" |
| 35 #include "ui/base/hit_test.h" | 33 #include "ui/base/hit_test.h" |
| 36 #include "ui/base/ui_base_types.h" | 34 #include "ui/base/ui_base_types.h" |
| 37 #include "ui/events/test/event_generator.h" | 35 #include "ui/events/test/event_generator.h" |
| 38 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
| 39 #include "ui/wm/core/coordinate_conversion.h" | 37 #include "ui/wm/core/coordinate_conversion.h" |
| 40 #include "ui/wm/core/window_util.h" | 38 #include "ui/wm/core/window_util.h" |
| 41 | 39 |
| 42 namespace ash { | 40 namespace ash { |
| 43 | 41 |
| 44 class DockedWindowResizerTest | 42 class DockedWindowResizerTest |
| 45 : public test::AshTestBase, | 43 : public test::AshTestBase, |
| 46 public testing::WithParamInterface<ui::wm::WindowType> { | 44 public testing::WithParamInterface<ui::wm::WindowType> { |
| 47 public: | 45 public: |
| 48 DockedWindowResizerTest() : model_(NULL), window_type_(GetParam()) {} | 46 DockedWindowResizerTest() : window_type_(GetParam()) {} |
| 49 virtual ~DockedWindowResizerTest() {} | 47 virtual ~DockedWindowResizerTest() {} |
| 50 | 48 |
| 51 void SetUp() override { | 49 void SetUp() override { |
| 52 AshTestBase::SetUp(); | 50 AshTestBase::SetUp(); |
| 53 UpdateDisplay("600x400"); | 51 UpdateDisplay("600x400"); |
| 54 model_ = WmShell::Get()->shelf_model(); | |
| 55 } | 52 } |
| 56 | 53 |
| 57 void TearDown() override { AshTestBase::TearDown(); } | 54 void TearDown() override { AshTestBase::TearDown(); } |
| 58 | 55 |
| 59 protected: | 56 protected: |
| 60 enum DockedEdge { | 57 enum DockedEdge { |
| 61 DOCKED_EDGE_NONE, | 58 DOCKED_EDGE_NONE, |
| 62 DOCKED_EDGE_LEFT, | 59 DOCKED_EDGE_LEFT, |
| 63 DOCKED_EDGE_RIGHT, | 60 DOCKED_EDGE_RIGHT, |
| 64 }; | 61 }; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 bool test_panels() const { return window_type_ == ui::wm::WINDOW_TYPE_PANEL; } | 224 bool test_panels() const { return window_type_ == ui::wm::WINDOW_TYPE_PANEL; } |
| 228 | 225 |
| 229 aura::test::TestWindowDelegate* delegate() { return &delegate_; } | 226 aura::test::TestWindowDelegate* delegate() { return &delegate_; } |
| 230 | 227 |
| 231 const gfx::Point& initial_location_in_parent() const { | 228 const gfx::Point& initial_location_in_parent() const { |
| 232 return initial_location_in_parent_; | 229 return initial_location_in_parent_; |
| 233 } | 230 } |
| 234 | 231 |
| 235 private: | 232 private: |
| 236 std::unique_ptr<WindowResizer> resizer_; | 233 std::unique_ptr<WindowResizer> resizer_; |
| 237 ShelfModel* model_; | |
| 238 ui::wm::WindowType window_type_; | 234 ui::wm::WindowType window_type_; |
| 239 aura::test::TestWindowDelegate delegate_; | 235 aura::test::TestWindowDelegate delegate_; |
| 240 | 236 |
| 241 // Location at start of the drag in |window->parent()|'s coordinates. | 237 // Location at start of the drag in |window->parent()|'s coordinates. |
| 242 gfx::Point initial_location_in_parent_; | 238 gfx::Point initial_location_in_parent_; |
| 243 | 239 |
| 244 DISALLOW_COPY_AND_ASSIGN(DockedWindowResizerTest); | 240 DISALLOW_COPY_AND_ASSIGN(DockedWindowResizerTest); |
| 245 }; | 241 }; |
| 246 | 242 |
| 247 // Verifies a window can be dragged and attached to the dock. | 243 // Verifies a window can be dragged and attached to the dock. |
| (...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1575 EXPECT_TRUE(window_state->IsMaximized()); | 1571 EXPECT_TRUE(window_state->IsMaximized()); |
| 1576 } | 1572 } |
| 1577 | 1573 |
| 1578 // Tests run twice - on both panels and normal windows | 1574 // Tests run twice - on both panels and normal windows |
| 1579 INSTANTIATE_TEST_CASE_P(NormalOrPanel, | 1575 INSTANTIATE_TEST_CASE_P(NormalOrPanel, |
| 1580 DockedWindowResizerTest, | 1576 DockedWindowResizerTest, |
| 1581 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 1577 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
| 1582 ui::wm::WINDOW_TYPE_PANEL)); | 1578 ui::wm::WINDOW_TYPE_PANEL)); |
| 1583 | 1579 |
| 1584 } // namespace ash | 1580 } // namespace ash |
| OLD | NEW |