| 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 13 matching lines...) Expand all Loading... |
| 24 #include "ash/wm/window_resizer.h" | 24 #include "ash/wm/window_resizer.h" |
| 25 #include "ash/wm/window_state.h" | 25 #include "ash/wm/window_state.h" |
| 26 #include "ash/wm/window_util.h" | 26 #include "ash/wm/window_util.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/display/manager/display_layout.h" |
| 34 #include "ui/gfx/screen.h" | 35 #include "ui/gfx/screen.h" |
| 35 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
| 36 #include "ui/wm/core/coordinate_conversion.h" | 37 #include "ui/wm/core/coordinate_conversion.h" |
| 37 | 38 |
| 38 namespace ash { | 39 namespace ash { |
| 39 | 40 |
| 40 class DockedWindowLayoutManagerTest | 41 class DockedWindowLayoutManagerTest |
| 41 : public test::AshTestBase, | 42 : public test::AshTestBase, |
| 42 public testing::WithParamInterface<ui::wm::WindowType> { | 43 public testing::WithParamInterface<ui::wm::WindowType> { |
| 43 public: | 44 public: |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 // Adds three windows in bottom display and tests layout after a drag. | 538 // Adds three windows in bottom display and tests layout after a drag. |
| 538 TEST_P(DockedWindowLayoutManagerTest, ThreeWindowsDraggingSecondScreen) { | 539 TEST_P(DockedWindowLayoutManagerTest, ThreeWindowsDraggingSecondScreen) { |
| 539 if (!SupportsMultipleDisplays() || !SupportsHostWindowResize()) | 540 if (!SupportsMultipleDisplays() || !SupportsHostWindowResize()) |
| 540 return; | 541 return; |
| 541 | 542 |
| 542 // Create two screen vertical layout. | 543 // Create two screen vertical layout. |
| 543 UpdateDisplay("600x1000,600x1000"); | 544 UpdateDisplay("600x1000,600x1000"); |
| 544 // Layout the secondary display to the bottom of the primary. | 545 // Layout the secondary display to the bottom of the primary. |
| 545 ASSERT_GT(gfx::Screen::GetScreen()->GetNumDisplays(), 1); | 546 ASSERT_GT(gfx::Screen::GetScreen()->GetNumDisplays(), 1); |
| 546 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( | 547 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( |
| 547 test::CreateDisplayLayout(DisplayPlacement::BOTTOM, 0)); | 548 test::CreateDisplayLayout(display::DisplayPlacement::BOTTOM, 0)); |
| 548 | 549 |
| 549 scoped_ptr<aura::Window> w1(CreateTestWindow(gfx::Rect(0, 1000, 201, 310))); | 550 scoped_ptr<aura::Window> w1(CreateTestWindow(gfx::Rect(0, 1000, 201, 310))); |
| 550 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w1.get(), 1000 + 20); | 551 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w1.get(), 1000 + 20); |
| 551 scoped_ptr<aura::Window> w2(CreateTestWindow(gfx::Rect(0, 1000, 210, 310))); | 552 scoped_ptr<aura::Window> w2(CreateTestWindow(gfx::Rect(0, 1000, 210, 310))); |
| 552 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 1000 + 500); | 553 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 1000 + 500); |
| 553 scoped_ptr<aura::Window> w3(CreateTestWindow(gfx::Rect(0, 1000, 220, 310))); | 554 scoped_ptr<aura::Window> w3(CreateTestWindow(gfx::Rect(0, 1000, 220, 310))); |
| 554 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w3.get(), 1000 + 600); | 555 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w3.get(), 1000 + 600); |
| 555 | 556 |
| 556 // All windows should be attached and snapped to the right side of the screen. | 557 // All windows should be attached and snapped to the right side of the screen. |
| 557 EXPECT_EQ(w1->GetRootWindow()->bounds().right(), | 558 EXPECT_EQ(w1->GetRootWindow()->bounds().right(), |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height()); | 858 EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height()); |
| 858 } | 859 } |
| 859 | 860 |
| 860 // Tests run twice - on both panels and normal windows | 861 // Tests run twice - on both panels and normal windows |
| 861 INSTANTIATE_TEST_CASE_P(NormalOrPanel, | 862 INSTANTIATE_TEST_CASE_P(NormalOrPanel, |
| 862 DockedWindowLayoutManagerTest, | 863 DockedWindowLayoutManagerTest, |
| 863 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 864 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
| 864 ui::wm::WINDOW_TYPE_PANEL)); | 865 ui::wm::WINDOW_TYPE_PANEL)); |
| 865 | 866 |
| 866 } // namespace ash | 867 } // namespace ash |
| OLD | NEW |