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

Side by Side Diff: ash/wm/workspace/workspace_window_resizer_unittest.cc

Issue 1924703002: Rename gfx::Display/Screen to display::Display/Screen in ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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
« no previous file with comments | « ash/wm/workspace/workspace_window_resizer.cc ('k') | ash/wm/workspace_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/workspace/workspace_window_resizer.h" 5 #include "ash/wm/workspace/workspace_window_resizer.h"
6 6
7 #include "ash/display/display_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_util.h" 9 #include "ash/screen_util.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
(...skipping 10 matching lines...) Expand all
21 #include "ash/wm/workspace/phantom_window_controller.h" 21 #include "ash/wm/workspace/phantom_window_controller.h"
22 #include "ash/wm/workspace_controller.h" 22 #include "ash/wm/workspace_controller.h"
23 #include "base/command_line.h" 23 #include "base/command_line.h"
24 #include "base/strings/string_number_conversions.h" 24 #include "base/strings/string_number_conversions.h"
25 #include "base/strings/stringprintf.h" 25 #include "base/strings/stringprintf.h"
26 #include "ui/aura/client/aura_constants.h" 26 #include "ui/aura/client/aura_constants.h"
27 #include "ui/aura/test/test_window_delegate.h" 27 #include "ui/aura/test/test_window_delegate.h"
28 #include "ui/aura/window_event_dispatcher.h" 28 #include "ui/aura/window_event_dispatcher.h"
29 #include "ui/base/hit_test.h" 29 #include "ui/base/hit_test.h"
30 #include "ui/display/manager/display_layout.h" 30 #include "ui/display/manager/display_layout.h"
31 #include "ui/display/screen.h"
31 #include "ui/events/gesture_detection/gesture_configuration.h" 32 #include "ui/events/gesture_detection/gesture_configuration.h"
32 #include "ui/events/test/event_generator.h" 33 #include "ui/events/test/event_generator.h"
33 #include "ui/gfx/geometry/insets.h" 34 #include "ui/gfx/geometry/insets.h"
34 #include "ui/gfx/screen.h"
35 #include "ui/views/widget/widget.h" 35 #include "ui/views/widget/widget.h"
36 36
37 namespace ash { 37 namespace ash {
38 namespace { 38 namespace {
39 39
40 const int kRootHeight = 600; 40 const int kRootHeight = 600;
41 41
42 // A simple window delegate that returns the specified min size. 42 // A simple window delegate that returns the specified min size.
43 class TestWindowDelegate : public aura::test::TestWindowDelegate { 43 class TestWindowDelegate : public aura::test::TestWindowDelegate {
44 public: 44 public:
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 650
651 TEST_F(WorkspaceWindowResizerTest, CancelSnapPhantom) { 651 TEST_F(WorkspaceWindowResizerTest, CancelSnapPhantom) {
652 if (!SupportsMultipleDisplays()) 652 if (!SupportsMultipleDisplays())
653 return; 653 return;
654 654
655 UpdateDisplay("800x600,800x600"); 655 UpdateDisplay("800x600,800x600");
656 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 656 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
657 ASSERT_EQ(2U, root_windows.size()); 657 ASSERT_EQ(2U, root_windows.size());
658 658
659 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), 659 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
660 gfx::Screen::GetScreen()->GetPrimaryDisplay()); 660 display::Screen::GetScreen()->GetPrimaryDisplay());
661 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); 661 EXPECT_EQ(root_windows[0], window_->GetRootWindow());
662 EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity()); 662 EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity());
663 { 663 {
664 std::unique_ptr<WindowResizer> resizer( 664 std::unique_ptr<WindowResizer> resizer(
665 CreateResizerForTest(window_.get(), gfx::Point(), HTCAPTION)); 665 CreateResizerForTest(window_.get(), gfx::Point(), HTCAPTION));
666 ASSERT_TRUE(resizer.get()); 666 ASSERT_TRUE(resizer.get());
667 EXPECT_FALSE(snap_phantom_window_controller()); 667 EXPECT_FALSE(snap_phantom_window_controller());
668 668
669 // The pointer is on the edge but not shared. The snap phantom window 669 // The pointer is on the edge but not shared. The snap phantom window
670 // controller should be non-NULL. 670 // controller should be non-NULL.
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 // 2 should be topmost since it's initially the highest in the stack. 797 // 2 should be topmost since it's initially the highest in the stack.
798 EXPECT_EQ("2 3 1", WindowOrderAsString(window_->parent())); 798 EXPECT_EQ("2 3 1", WindowOrderAsString(window_->parent()));
799 } 799 }
800 } 800 }
801 801
802 // Makes sure we don't allow dragging below the work area. 802 // Makes sure we don't allow dragging below the work area.
803 TEST_F(WorkspaceWindowResizerTest, DontDragOffBottom) { 803 TEST_F(WorkspaceWindowResizerTest, DontDragOffBottom) {
804 Shell::GetInstance()->SetDisplayWorkAreaInsets( 804 Shell::GetInstance()->SetDisplayWorkAreaInsets(
805 Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0)); 805 Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0));
806 806
807 ASSERT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays()); 807 ASSERT_EQ(1, display::Screen::GetScreen()->GetNumDisplays());
808 808
809 window_->SetBounds(gfx::Rect(100, 200, 300, 400)); 809 window_->SetBounds(gfx::Rect(100, 200, 300, 400));
810 std::unique_ptr<WindowResizer> resizer( 810 std::unique_ptr<WindowResizer> resizer(
811 CreateResizerForTest(window_.get(), gfx::Point(), HTCAPTION)); 811 CreateResizerForTest(window_.get(), gfx::Point(), HTCAPTION));
812 ASSERT_TRUE(resizer.get()); 812 ASSERT_TRUE(resizer.get());
813 resizer->Drag(CalculateDragPoint(*resizer, 0, 600), 0); 813 resizer->Drag(CalculateDragPoint(*resizer, 0, 600), 0);
814 int expected_y = 814 int expected_y =
815 kRootHeight - WorkspaceWindowResizer::kMinOnscreenHeight - 10; 815 kRootHeight - WorkspaceWindowResizer::kMinOnscreenHeight - 10;
816 EXPECT_EQ("100," + base::IntToString(expected_y) + " 300x400", 816 EXPECT_EQ("100," + base::IntToString(expected_y) + " 300x400",
817 window_->bounds().ToString()); 817 window_->bounds().ToString());
818 } 818 }
819 819
820 // Makes sure we don't allow dragging on the work area with multidisplay. 820 // Makes sure we don't allow dragging on the work area with multidisplay.
821 TEST_F(WorkspaceWindowResizerTest, DontDragOffBottomWithMultiDisplay) { 821 TEST_F(WorkspaceWindowResizerTest, DontDragOffBottomWithMultiDisplay) {
822 if (!SupportsMultipleDisplays()) 822 if (!SupportsMultipleDisplays())
823 return; 823 return;
824 824
825 UpdateDisplay("800x600,800x600"); 825 UpdateDisplay("800x600,800x600");
826 ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); 826 ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays());
827 827
828 Shell::GetInstance()->SetDisplayWorkAreaInsets( 828 Shell::GetInstance()->SetDisplayWorkAreaInsets(
829 Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0)); 829 Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0));
830 830
831 // Positions the secondary display at the bottom the primary display. 831 // Positions the secondary display at the bottom the primary display.
832 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( 832 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays(
833 test::CreateDisplayLayout(display::DisplayPlacement::BOTTOM, 0)); 833 test::CreateDisplayLayout(display::DisplayPlacement::BOTTOM, 0));
834 834
835 { 835 {
836 window_->SetBounds(gfx::Rect(100, 200, 300, 20)); 836 window_->SetBounds(gfx::Rect(100, 200, 300, 20));
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 // Drag even more to snap to the edge. 1888 // Drag even more to snap to the edge.
1889 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), 1889 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40),
1890 gfx::Point(400, kRootHeight - 25), 1890 gfx::Point(400, kRootHeight - 25),
1891 base::TimeDelta::FromMilliseconds(10), 1891 base::TimeDelta::FromMilliseconds(10),
1892 5); 1892 5);
1893 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), 1893 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(),
1894 touch_resize_window_->bounds().ToString()); 1894 touch_resize_window_->bounds().ToString());
1895 } 1895 }
1896 1896
1897 } // namespace ash 1897 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_window_resizer.cc ('k') | ash/wm/workspace_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698