| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/drag_window_resizer.h" | 5 #include "ash/wm/drag_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/display/display_layout_builder.h" | |
| 8 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
| 9 #include "ash/display/mouse_cursor_event_filter.h" | 8 #include "ash/display/mouse_cursor_event_filter.h" |
| 10 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 11 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| 12 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 13 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
| 14 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.h" |
| 15 #include "ash/test/cursor_manager_test_api.h" | 14 #include "ash/test/cursor_manager_test_api.h" |
| 16 #include "ash/test/display_manager_test_api.h" | 15 #include "ash/test/display_manager_test_api.h" |
| 17 #include "ash/wm/drag_window_controller.h" | 16 #include "ash/wm/drag_window_controller.h" |
| 18 #include "ash/wm/window_util.h" | 17 #include "ash/wm/window_util.h" |
| 19 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 20 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
| 21 #include "ui/aura/client/aura_constants.h" | 20 #include "ui/aura/client/aura_constants.h" |
| 22 #include "ui/aura/env.h" | 21 #include "ui/aura/env.h" |
| 23 #include "ui/aura/test/test_window_delegate.h" | 22 #include "ui/aura/test/test_window_delegate.h" |
| 24 #include "ui/base/hit_test.h" | 23 #include "ui/base/hit_test.h" |
| 25 #include "ui/base/ui_base_types.h" | 24 #include "ui/base/ui_base_types.h" |
| 26 #include "ui/compositor/layer_tree_owner.h" | 25 #include "ui/compositor/layer_tree_owner.h" |
| 26 #include "ui/display/manager/display_layout.h" |
| 27 #include "ui/display/manager/display_layout_builder.h" |
| 27 #include "ui/gfx/geometry/insets.h" | 28 #include "ui/gfx/geometry/insets.h" |
| 28 #include "ui/views/widget/widget.h" | 29 #include "ui/views/widget/widget.h" |
| 29 #include "ui/wm/core/window_util.h" | 30 #include "ui/wm/core/window_util.h" |
| 30 | 31 |
| 31 namespace ash { | 32 namespace ash { |
| 32 namespace { | 33 namespace { |
| 33 | 34 |
| 34 const int kRootHeight = 600; | 35 const int kRootHeight = 600; |
| 35 | 36 |
| 36 } // namespace | 37 } // namespace |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 | 419 |
| 419 TEST_F(DragWindowResizerTest, DragWindowControllerAcrossThreeDisplays) { | 420 TEST_F(DragWindowResizerTest, DragWindowControllerAcrossThreeDisplays) { |
| 420 if (!SupportsMultipleDisplays()) | 421 if (!SupportsMultipleDisplays()) |
| 421 return; | 422 return; |
| 422 | 423 |
| 423 UpdateDisplay("400x600,400x600,800x600"); | 424 UpdateDisplay("400x600,400x600,800x600"); |
| 424 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 425 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 425 | 426 |
| 426 // Layout so that all three displays touch each other. | 427 // Layout so that all three displays touch each other. |
| 427 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 428 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 428 DisplayIdList list = display_manager->GetCurrentDisplayIdList(); | 429 display::DisplayIdList list = display_manager->GetCurrentDisplayIdList(); |
| 429 ASSERT_EQ(3u, list.size()); | 430 ASSERT_EQ(3u, list.size()); |
| 430 ASSERT_EQ(gfx::Screen::GetScreen()->GetPrimaryDisplay().id(), list[0]); | 431 ASSERT_EQ(gfx::Screen::GetScreen()->GetPrimaryDisplay().id(), list[0]); |
| 431 DisplayLayoutBuilder builder(list[0]); | 432 display::DisplayLayoutBuilder builder(list[0]); |
| 432 builder.AddDisplayPlacement(list[1], list[0], DisplayPlacement::RIGHT, 0); | 433 builder.AddDisplayPlacement(list[1], list[0], |
| 433 builder.AddDisplayPlacement(list[2], list[0], DisplayPlacement::BOTTOM, 0); | 434 display::DisplayPlacement::RIGHT, 0); |
| 435 builder.AddDisplayPlacement(list[2], list[0], |
| 436 display::DisplayPlacement::BOTTOM, 0); |
| 434 display_manager->SetLayoutForCurrentDisplays(builder.Build()); | 437 display_manager->SetLayoutForCurrentDisplays(builder.Build()); |
| 435 // Sanity check. | 438 // Sanity check. |
| 436 ASSERT_EQ(gfx::Rect(0, 000, 400, 600), | 439 ASSERT_EQ(gfx::Rect(0, 000, 400, 600), |
| 437 display_manager->GetDisplayForId(list[0]).bounds()); | 440 display_manager->GetDisplayForId(list[0]).bounds()); |
| 438 ASSERT_EQ(gfx::Rect(400, 0, 400, 600), | 441 ASSERT_EQ(gfx::Rect(400, 0, 400, 600), |
| 439 display_manager->GetDisplayForId(list[1]).bounds()); | 442 display_manager->GetDisplayForId(list[1]).bounds()); |
| 440 ASSERT_EQ(gfx::Rect(0, 600, 800, 600), | 443 ASSERT_EQ(gfx::Rect(0, 600, 800, 600), |
| 441 display_manager->GetDisplayForId(list[2]).bounds()); | 444 display_manager->GetDisplayForId(list[2]).bounds()); |
| 442 | 445 |
| 443 // Create a window on 2nd display. | 446 // Create a window on 2nd display. |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 ASSERT_TRUE(resizer.get()); | 724 ASSERT_TRUE(resizer.get()); |
| 722 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); | 725 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); |
| 723 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(399, 200))); | 726 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(399, 200))); |
| 724 EXPECT_EQ("401,200", | 727 EXPECT_EQ("401,200", |
| 725 aura::Env::GetInstance()->last_mouse_location().ToString()); | 728 aura::Env::GetInstance()->last_mouse_location().ToString()); |
| 726 resizer->CompleteDrag(); | 729 resizer->CompleteDrag(); |
| 727 } | 730 } |
| 728 } | 731 } |
| 729 | 732 |
| 730 } // namespace ash | 733 } // namespace ash |
| OLD | NEW |