| 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/workspace/workspace_window_resizer.h" | 5 #include "ash/wm/workspace/workspace_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/display/mouse_cursor_event_filter.h" | 7 #include "ash/display/mouse_cursor_event_filter.h" |
| 8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 private: | 130 private: |
| 131 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizerTest); | 131 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizerTest); |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 } // namespace | 134 } // namespace |
| 135 | 135 |
| 136 // Fails on win_aura since wm::GetRootWindowRelativeToWindow is not implemented | 136 // Fails on win_aura since wm::GetRootWindowRelativeToWindow is not implemented |
| 137 // yet for the platform. | 137 // yet for the platform. |
| 138 #if defined(OS_WIN) | 138 #if defined(OS_WIN) |
| 139 #define MAYBE_WindowDragWithMultiMonitors \ | 139 #define MAYBE_WindowDragWithMultiDisplays \ |
| 140 DISABLED_WindowDragWithMultiMonitors | 140 DISABLED_WindowDragWithMultiDisplays |
| 141 #define MAYBE_WindowDragWithMultiMonitorsRightToLeft \ | 141 #define MAYBE_WindowDragWithMultiDisplaysRightToLeft \ |
| 142 DISABLED_WindowDragWithMultiMonitorsRightToLeft | 142 DISABLED_WindowDragWithMultiDisplaysRightToLeft |
| 143 #define MAYBE_PhantomStyle DISABLED_PhantomStyle | 143 #define MAYBE_PhantomStyle DISABLED_PhantomStyle |
| 144 #else | 144 #else |
| 145 #define MAYBE_WindowDragWithMultiMonitors WindowDragWithMultiMonitors | 145 #define MAYBE_WindowDragWithMultiDisplays WindowDragWithMultiDisplays |
| 146 #define MAYBE_WindowDragWithMultiMonitorsRightToLeft \ | 146 #define MAYBE_WindowDragWithMultiDisplaysRightToLeft \ |
| 147 WindowDragWithMultiMonitorsRightToLeft | 147 WindowDragWithMultiDisplaysRightToLeft |
| 148 #define MAYBE_PhantomStyle PhantomStyle | 148 #define MAYBE_PhantomStyle PhantomStyle |
| 149 #endif | 149 #endif |
| 150 | 150 |
| 151 // Assertions around attached window resize dragging from the right with 2 | 151 // Assertions around attached window resize dragging from the right with 2 |
| 152 // windows. | 152 // windows. |
| 153 TEST_F(WorkspaceWindowResizerTest, AttachedResize_RIGHT_2) { | 153 TEST_F(WorkspaceWindowResizerTest, AttachedResize_RIGHT_2) { |
| 154 window_->SetBounds(gfx::Rect(0, 300, 400, 300)); | 154 window_->SetBounds(gfx::Rect(0, 300, 400, 300)); |
| 155 window2_->SetBounds(gfx::Rect(400, 200, 100, 200)); | 155 window2_->SetBounds(gfx::Rect(400, 200, 100, 200)); |
| 156 | 156 |
| 157 std::vector<aura::Window*> windows; | 157 std::vector<aura::Window*> windows; |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 ASSERT_TRUE(resizer.get()); | 465 ASSERT_TRUE(resizer.get()); |
| 466 resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0); | 466 resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0); |
| 467 resizer->CompleteDrag(0); | 467 resizer->CompleteDrag(0); |
| 468 EXPECT_EQ("80,0 720x" + base::IntToString(bottom), | 468 EXPECT_EQ("80,0 720x" + base::IntToString(bottom), |
| 469 window_->bounds().ToString()); | 469 window_->bounds().ToString()); |
| 470 ASSERT_TRUE(GetRestoreBoundsInScreen(window_.get())); | 470 ASSERT_TRUE(GetRestoreBoundsInScreen(window_.get())); |
| 471 EXPECT_EQ("20,30 50x60", GetRestoreBoundsInScreen(window_.get())->ToString()); | 471 EXPECT_EQ("20,30 50x60", GetRestoreBoundsInScreen(window_.get())->ToString()); |
| 472 } | 472 } |
| 473 | 473 |
| 474 // Verifies a window can be moved from the primary display to another. | 474 // Verifies a window can be moved from the primary display to another. |
| 475 TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiMonitors) { | 475 TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) { |
| 476 // The secondary display is logically on the right, but on the system (e.g. X) | 476 // The secondary display is logically on the right, but on the system (e.g. X) |
| 477 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. | 477 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. |
| 478 UpdateDisplay("800x600,800x600"); | 478 UpdateDisplay("800x600,800x600"); |
| 479 Shell::GetInstance()->shelf()->LayoutShelf(); | 479 Shell::GetInstance()->shelf()->LayoutShelf(); |
| 480 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 480 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 481 ASSERT_EQ(2U, root_windows.size()); | 481 ASSERT_EQ(2U, root_windows.size()); |
| 482 | 482 |
| 483 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), | 483 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), |
| 484 gfx::Screen::GetPrimaryDisplay()); | 484 gfx::Screen::GetPrimaryDisplay()); |
| 485 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); | 485 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 // Since the pointer is on the secondary, the parent should not be changed | 531 // Since the pointer is on the secondary, the parent should not be changed |
| 532 // even though only small fraction of the window is within the secondary | 532 // even though only small fraction of the window is within the secondary |
| 533 // root window's bounds. | 533 // root window's bounds. |
| 534 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); | 534 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); |
| 535 EXPECT_EQ("-49,10 50x60", window_->bounds().ToString()); | 535 EXPECT_EQ("-49,10 50x60", window_->bounds().ToString()); |
| 536 } | 536 } |
| 537 } | 537 } |
| 538 | 538 |
| 539 // Verifies a window can be moved from the secondary display to primary. | 539 // Verifies a window can be moved from the secondary display to primary. |
| 540 TEST_F(WorkspaceWindowResizerTest, | 540 TEST_F(WorkspaceWindowResizerTest, |
| 541 MAYBE_WindowDragWithMultiMonitorsRightToLeft) { | 541 MAYBE_WindowDragWithMultiDisplaysRightToLeft) { |
| 542 UpdateDisplay("800x600,800x600"); | 542 UpdateDisplay("800x600,800x600"); |
| 543 Shell::GetInstance()->shelf()->LayoutShelf(); | 543 Shell::GetInstance()->shelf()->LayoutShelf(); |
| 544 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 544 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 545 ASSERT_EQ(2U, root_windows.size()); | 545 ASSERT_EQ(2U, root_windows.size()); |
| 546 | 546 |
| 547 window_->SetBoundsInScreen( | 547 window_->SetBoundsInScreen( |
| 548 gfx::Rect(800, 00, 50, 60), | 548 gfx::Rect(800, 00, 50, 60), |
| 549 gfx::Screen::GetDisplayNearestWindow(root_windows[1])); | 549 gfx::Screen::GetDisplayNearestWindow(root_windows[1])); |
| 550 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); | 550 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); |
| 551 { | 551 { |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 rect = resizer->GetTargetBoundsForSize(1); | 864 rect = resizer->GetTargetBoundsForSize(1); |
| 865 EXPECT_EQ("0,0 720x552", rect.ToString()); | 865 EXPECT_EQ("0,0 720x552", rect.ToString()); |
| 866 rect = resizer->GetTargetBoundsForSize(2); | 866 rect = resizer->GetTargetBoundsForSize(2); |
| 867 EXPECT_EQ("0,0 720x552", rect.ToString()); | 867 EXPECT_EQ("0,0 720x552", rect.ToString()); |
| 868 rect = resizer->GetTargetBoundsForSize(3); | 868 rect = resizer->GetTargetBoundsForSize(3); |
| 869 EXPECT_EQ("0,0 640x552", rect.ToString()); | 869 EXPECT_EQ("0,0 640x552", rect.ToString()); |
| 870 } | 870 } |
| 871 | 871 |
| 872 } // namespace internal | 872 } // namespace internal |
| 873 } // namespace ash | 873 } // namespace ash |
| OLD | NEW |