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/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
9 #include "ash/common/shelf/shelf_layout_manager.h" | 9 #include "ash/common/shelf/shelf_layout_manager.h" |
10 #include "ash/common/wm/window_positioning_utils.h" | 10 #include "ash/common/wm/window_positioning_utils.h" |
11 #include "ash/display/display_manager.h" | |
12 #include "ash/display/mouse_cursor_event_filter.h" | 11 #include "ash/display/mouse_cursor_event_filter.h" |
13 #include "ash/public/cpp/shell_window_ids.h" | 12 #include "ash/public/cpp/shell_window_ids.h" |
14 #include "ash/root_window_controller.h" | 13 #include "ash/root_window_controller.h" |
15 #include "ash/shell.h" | 14 #include "ash/shell.h" |
16 #include "ash/test/ash_md_test_base.h" | 15 #include "ash/test/ash_md_test_base.h" |
17 #include "ash/test/cursor_manager_test_api.h" | 16 #include "ash/test/cursor_manager_test_api.h" |
18 #include "ash/test/display_manager_test_api.h" | |
19 #include "ash/wm/drag_window_controller.h" | 17 #include "ash/wm/drag_window_controller.h" |
20 #include "ash/wm/window_util.h" | 18 #include "ash/wm/window_util.h" |
21 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
22 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
23 #include "ui/aura/client/aura_constants.h" | 21 #include "ui/aura/client/aura_constants.h" |
24 #include "ui/aura/env.h" | 22 #include "ui/aura/env.h" |
25 #include "ui/aura/test/test_window_delegate.h" | 23 #include "ui/aura/test/test_window_delegate.h" |
26 #include "ui/base/hit_test.h" | 24 #include "ui/base/hit_test.h" |
27 #include "ui/base/ui_base_types.h" | 25 #include "ui/base/ui_base_types.h" |
28 #include "ui/compositor/layer_delegate.h" | 26 #include "ui/compositor/layer_delegate.h" |
29 #include "ui/compositor/layer_tree_owner.h" | 27 #include "ui/compositor/layer_tree_owner.h" |
30 #include "ui/display/manager/display_layout.h" | 28 #include "ui/display/manager/display_layout.h" |
31 #include "ui/display/manager/display_layout_builder.h" | 29 #include "ui/display/manager/display_layout_builder.h" |
30 #include "ui/display/manager/display_manager.h" | |
31 #include "ui/display/test/display_manager_test_api.h" | |
oshima
2016/10/24 19:29:16
ditto
rjkroege
2016/10/25 23:30:26
Done.
| |
32 #include "ui/gfx/geometry/insets.h" | 32 #include "ui/gfx/geometry/insets.h" |
33 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
34 #include "ui/wm/core/window_util.h" | 34 #include "ui/wm/core/window_util.h" |
35 | 35 |
36 namespace ash { | 36 namespace ash { |
37 namespace { | 37 namespace { |
38 | 38 |
39 const int kRootHeight = 600; | 39 const int kRootHeight = 600; |
40 | 40 |
41 // Used to test if the OnPaintLayer is called by DragWindowLayerDelegate. | 41 // Used to test if the OnPaintLayer is called by DragWindowLayerDelegate. |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
464 } | 464 } |
465 | 465 |
466 TEST_P(DragWindowResizerTest, DragWindowControllerAcrossThreeDisplays) { | 466 TEST_P(DragWindowResizerTest, DragWindowControllerAcrossThreeDisplays) { |
467 if (!SupportsMultipleDisplays()) | 467 if (!SupportsMultipleDisplays()) |
468 return; | 468 return; |
469 | 469 |
470 UpdateDisplay("400x600,400x600,800x600"); | 470 UpdateDisplay("400x600,400x600,800x600"); |
471 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 471 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
472 | 472 |
473 // Layout so that all three displays touch each other. | 473 // Layout so that all three displays touch each other. |
474 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 474 display::DisplayIdList list = display_manager()->GetCurrentDisplayIdList(); |
475 display::DisplayIdList list = display_manager->GetCurrentDisplayIdList(); | |
476 ASSERT_EQ(3u, list.size()); | 475 ASSERT_EQ(3u, list.size()); |
477 ASSERT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().id(), list[0]); | 476 ASSERT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().id(), list[0]); |
478 display::DisplayLayoutBuilder builder(list[0]); | 477 display::DisplayLayoutBuilder builder(list[0]); |
479 builder.AddDisplayPlacement(list[1], list[0], | 478 builder.AddDisplayPlacement(list[1], list[0], |
480 display::DisplayPlacement::RIGHT, 0); | 479 display::DisplayPlacement::RIGHT, 0); |
481 builder.AddDisplayPlacement(list[2], list[0], | 480 builder.AddDisplayPlacement(list[2], list[0], |
482 display::DisplayPlacement::BOTTOM, 0); | 481 display::DisplayPlacement::BOTTOM, 0); |
483 display_manager->SetLayoutForCurrentDisplays(builder.Build()); | 482 display_manager()->SetLayoutForCurrentDisplays(builder.Build()); |
484 // Sanity check. | 483 // Sanity check. |
485 ASSERT_EQ(gfx::Rect(0, 000, 400, 600), | 484 ASSERT_EQ(gfx::Rect(0, 000, 400, 600), |
486 display_manager->GetDisplayForId(list[0]).bounds()); | 485 display_manager()->GetDisplayForId(list[0]).bounds()); |
487 ASSERT_EQ(gfx::Rect(400, 0, 400, 600), | 486 ASSERT_EQ(gfx::Rect(400, 0, 400, 600), |
488 display_manager->GetDisplayForId(list[1]).bounds()); | 487 display_manager()->GetDisplayForId(list[1]).bounds()); |
489 ASSERT_EQ(gfx::Rect(0, 600, 800, 600), | 488 ASSERT_EQ(gfx::Rect(0, 600, 800, 600), |
490 display_manager->GetDisplayForId(list[2]).bounds()); | 489 display_manager()->GetDisplayForId(list[2]).bounds()); |
491 | 490 |
492 // Create a window on 2nd display. | 491 // Create a window on 2nd display. |
493 window_->SetBoundsInScreen(gfx::Rect(400, 0, 100, 100), | 492 window_->SetBoundsInScreen(gfx::Rect(400, 0, 100, 100), |
494 display_manager->GetDisplayForId(list[1])); | 493 display_manager()->GetDisplayForId(list[1])); |
495 ASSERT_EQ(root_windows[1], window_->GetRootWindow()); | 494 ASSERT_EQ(root_windows[1], window_->GetRootWindow()); |
496 | 495 |
497 // Hold the center of the window so that the window doesn't stick to the edge | 496 // Hold the center of the window so that the window doesn't stick to the edge |
498 // when dragging around the edge of the display. | 497 // when dragging around the edge of the display. |
499 std::unique_ptr<WindowResizer> resizer( | 498 std::unique_ptr<WindowResizer> resizer( |
500 CreateDragWindowResizer(window_.get(), gfx::Point(50, 50), HTCAPTION)); | 499 CreateDragWindowResizer(window_.get(), gfx::Point(50, 50), HTCAPTION)); |
501 ASSERT_TRUE(resizer.get()); | 500 ASSERT_TRUE(resizer.get()); |
502 DragWindowResizer* drag_resizer = DragWindowResizer::instance_; | 501 DragWindowResizer* drag_resizer = DragWindowResizer::instance_; |
503 ASSERT_TRUE(drag_resizer); | 502 ASSERT_TRUE(drag_resizer); |
504 EXPECT_FALSE(drag_resizer->drag_window_controller_.get()); | 503 EXPECT_FALSE(drag_resizer->drag_window_controller_.get()); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
777 ASSERT_TRUE(resizer.get()); | 776 ASSERT_TRUE(resizer.get()); |
778 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); | 777 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); |
779 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(399, 200))); | 778 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(399, 200))); |
780 EXPECT_EQ("401,200", | 779 EXPECT_EQ("401,200", |
781 aura::Env::GetInstance()->last_mouse_location().ToString()); | 780 aura::Env::GetInstance()->last_mouse_location().ToString()); |
782 resizer->CompleteDrag(); | 781 resizer->CompleteDrag(); |
783 } | 782 } |
784 } | 783 } |
785 | 784 |
786 } // namespace ash | 785 } // namespace ash |
OLD | NEW |