Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Side by Side Diff: ash/wm/drag_window_resizer_unittest.cc

Issue 2445583002: Relocate display_manager from ash to ui (Closed)
Patch Set: fix windows build Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
32 #include "ui/gfx/geometry/insets.h" 31 #include "ui/gfx/geometry/insets.h"
33 #include "ui/views/widget/widget.h" 32 #include "ui/views/widget/widget.h"
34 #include "ui/wm/core/window_util.h" 33 #include "ui/wm/core/window_util.h"
35 34
36 namespace ash { 35 namespace ash {
37 namespace { 36 namespace {
38 37
39 const int kRootHeight = 600; 38 const int kRootHeight = 600;
40 39
41 // Used to test if the OnPaintLayer is called by DragWindowLayerDelegate. 40 // Used to test if the OnPaintLayer is called by DragWindowLayerDelegate.
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 } 463 }
465 464
466 TEST_P(DragWindowResizerTest, DragWindowControllerAcrossThreeDisplays) { 465 TEST_P(DragWindowResizerTest, DragWindowControllerAcrossThreeDisplays) {
467 if (!SupportsMultipleDisplays()) 466 if (!SupportsMultipleDisplays())
468 return; 467 return;
469 468
470 UpdateDisplay("400x600,400x600,800x600"); 469 UpdateDisplay("400x600,400x600,800x600");
471 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 470 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
472 471
473 // Layout so that all three displays touch each other. 472 // Layout so that all three displays touch each other.
474 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 473 display::DisplayIdList list = display_manager()->GetCurrentDisplayIdList();
475 display::DisplayIdList list = display_manager->GetCurrentDisplayIdList();
476 ASSERT_EQ(3u, list.size()); 474 ASSERT_EQ(3u, list.size());
477 ASSERT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().id(), list[0]); 475 ASSERT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().id(), list[0]);
478 display::DisplayLayoutBuilder builder(list[0]); 476 display::DisplayLayoutBuilder builder(list[0]);
479 builder.AddDisplayPlacement(list[1], list[0], 477 builder.AddDisplayPlacement(list[1], list[0],
480 display::DisplayPlacement::RIGHT, 0); 478 display::DisplayPlacement::RIGHT, 0);
481 builder.AddDisplayPlacement(list[2], list[0], 479 builder.AddDisplayPlacement(list[2], list[0],
482 display::DisplayPlacement::BOTTOM, 0); 480 display::DisplayPlacement::BOTTOM, 0);
483 display_manager->SetLayoutForCurrentDisplays(builder.Build()); 481 display_manager()->SetLayoutForCurrentDisplays(builder.Build());
484 // Sanity check. 482 // Sanity check.
485 ASSERT_EQ(gfx::Rect(0, 000, 400, 600), 483 ASSERT_EQ(gfx::Rect(0, 000, 400, 600),
486 display_manager->GetDisplayForId(list[0]).bounds()); 484 display_manager()->GetDisplayForId(list[0]).bounds());
487 ASSERT_EQ(gfx::Rect(400, 0, 400, 600), 485 ASSERT_EQ(gfx::Rect(400, 0, 400, 600),
488 display_manager->GetDisplayForId(list[1]).bounds()); 486 display_manager()->GetDisplayForId(list[1]).bounds());
489 ASSERT_EQ(gfx::Rect(0, 600, 800, 600), 487 ASSERT_EQ(gfx::Rect(0, 600, 800, 600),
490 display_manager->GetDisplayForId(list[2]).bounds()); 488 display_manager()->GetDisplayForId(list[2]).bounds());
491 489
492 // Create a window on 2nd display. 490 // Create a window on 2nd display.
493 window_->SetBoundsInScreen(gfx::Rect(400, 0, 100, 100), 491 window_->SetBoundsInScreen(gfx::Rect(400, 0, 100, 100),
494 display_manager->GetDisplayForId(list[1])); 492 display_manager()->GetDisplayForId(list[1]));
495 ASSERT_EQ(root_windows[1], window_->GetRootWindow()); 493 ASSERT_EQ(root_windows[1], window_->GetRootWindow());
496 494
497 // Hold the center of the window so that the window doesn't stick to the edge 495 // 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. 496 // when dragging around the edge of the display.
499 std::unique_ptr<WindowResizer> resizer( 497 std::unique_ptr<WindowResizer> resizer(
500 CreateDragWindowResizer(window_.get(), gfx::Point(50, 50), HTCAPTION)); 498 CreateDragWindowResizer(window_.get(), gfx::Point(50, 50), HTCAPTION));
501 ASSERT_TRUE(resizer.get()); 499 ASSERT_TRUE(resizer.get());
502 DragWindowResizer* drag_resizer = DragWindowResizer::instance_; 500 DragWindowResizer* drag_resizer = DragWindowResizer::instance_;
503 ASSERT_TRUE(drag_resizer); 501 ASSERT_TRUE(drag_resizer);
504 EXPECT_FALSE(drag_resizer->drag_window_controller_.get()); 502 EXPECT_FALSE(drag_resizer->drag_window_controller_.get());
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 ASSERT_TRUE(resizer.get()); 775 ASSERT_TRUE(resizer.get());
778 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); 776 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0);
779 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(399, 200))); 777 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(399, 200)));
780 EXPECT_EQ("401,200", 778 EXPECT_EQ("401,200",
781 aura::Env::GetInstance()->last_mouse_location().ToString()); 779 aura::Env::GetInstance()->last_mouse_location().ToString());
782 resizer->CompleteDrag(); 780 resizer->CompleteDrag();
783 } 781 }
784 } 782 }
785 783
786 } // namespace ash 784 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager_unittest.cc ('k') | ash/wm/immersive_fullscreen_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698