| 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/ash_constants.h" | 7 #include "ash/ash_constants.h" |
| 8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 window_state->GetRestoreBoundsInScreen().ToString()); | 574 window_state->GetRestoreBoundsInScreen().ToString()); |
| 575 } | 575 } |
| 576 | 576 |
| 577 // Test if the restore bounds is correct in multiple displays. | 577 // Test if the restore bounds is correct in multiple displays. |
| 578 window_state->ClearRestoreBounds(); | 578 window_state->ClearRestoreBounds(); |
| 579 | 579 |
| 580 if (!SupportsMultipleDisplays()) | 580 if (!SupportsMultipleDisplays()) |
| 581 return; | 581 return; |
| 582 | 582 |
| 583 UpdateDisplay("800x600,200x600"); | 583 UpdateDisplay("800x600,200x600"); |
| 584 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 584 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 585 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); | 585 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); |
| 586 window_->SetBoundsInScreen(gfx::Rect(800, 10, 50, 60), | 586 window_->SetBoundsInScreen(gfx::Rect(800, 10, 50, 60), |
| 587 ScreenAsh::GetSecondaryDisplay()); | 587 ScreenAsh::GetSecondaryDisplay()); |
| 588 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); | 588 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); |
| 589 { | 589 { |
| 590 bottom = | 590 bottom = |
| 591 ScreenAsh::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom(); | 591 ScreenAsh::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom(); |
| 592 EXPECT_EQ("800,10 50x60", window_->GetBoundsInScreen().ToString()); | 592 EXPECT_EQ("800,10 50x60", window_->GetBoundsInScreen().ToString()); |
| 593 | 593 |
| 594 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( | 594 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( |
| (...skipping 24 matching lines...) Expand all Loading... |
| 619 resizer->Drag(CalculateDragPoint(*resizer, -20, 0), 0); | 619 resizer->Drag(CalculateDragPoint(*resizer, -20, 0), 0); |
| 620 resizer->CompleteDrag(0); | 620 resizer->CompleteDrag(0); |
| 621 EXPECT_EQ("0,30 50x60", window_->bounds().ToString()); | 621 EXPECT_EQ("0,30 50x60", window_->bounds().ToString()); |
| 622 } | 622 } |
| 623 | 623 |
| 624 TEST_F(WorkspaceWindowResizerTest, CancelSnapPhantom) { | 624 TEST_F(WorkspaceWindowResizerTest, CancelSnapPhantom) { |
| 625 if (!SupportsMultipleDisplays()) | 625 if (!SupportsMultipleDisplays()) |
| 626 return; | 626 return; |
| 627 | 627 |
| 628 UpdateDisplay("800x600,800x600"); | 628 UpdateDisplay("800x600,800x600"); |
| 629 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 629 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 630 ASSERT_EQ(2U, root_windows.size()); | 630 ASSERT_EQ(2U, root_windows.size()); |
| 631 | 631 |
| 632 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), | 632 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), |
| 633 Shell::GetScreen()->GetPrimaryDisplay()); | 633 Shell::GetScreen()->GetPrimaryDisplay()); |
| 634 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); | 634 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); |
| 635 EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity()); | 635 EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity()); |
| 636 { | 636 { |
| 637 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( | 637 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( |
| 638 window_.get(), gfx::Point(), HTCAPTION, | 638 window_.get(), gfx::Point(), HTCAPTION, |
| 639 aura::client::WINDOW_MOVE_SOURCE_MOUSE, empty_windows())); | 639 aura::client::WINDOW_MOVE_SOURCE_MOUSE, empty_windows())); |
| (...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 touch_resize_window_->bounds().ToString()); | 1867 touch_resize_window_->bounds().ToString()); |
| 1868 } | 1868 } |
| 1869 | 1869 |
| 1870 TEST_F(WorkspaceWindowResizerTest, PhantomWindowShow) { | 1870 TEST_F(WorkspaceWindowResizerTest, PhantomWindowShow) { |
| 1871 if (!SupportsMultipleDisplays()) | 1871 if (!SupportsMultipleDisplays()) |
| 1872 return; | 1872 return; |
| 1873 | 1873 |
| 1874 UpdateDisplay("500x400,500x400"); | 1874 UpdateDisplay("500x400,500x400"); |
| 1875 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), | 1875 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), |
| 1876 Shell::GetScreen()->GetPrimaryDisplay()); | 1876 Shell::GetScreen()->GetPrimaryDisplay()); |
| 1877 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 1877 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 1878 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); | 1878 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); |
| 1879 | 1879 |
| 1880 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( | 1880 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( |
| 1881 window_.get(), gfx::Point(0,0), HTCAPTION, | 1881 window_.get(), gfx::Point(0,0), HTCAPTION, |
| 1882 aura::client::WINDOW_MOVE_SOURCE_MOUSE, empty_windows())); | 1882 aura::client::WINDOW_MOVE_SOURCE_MOUSE, empty_windows())); |
| 1883 ASSERT_TRUE(resizer.get()); | 1883 ASSERT_TRUE(resizer.get()); |
| 1884 EXPECT_FALSE(resizer->snap_phantom_window_controller_.get()); | 1884 EXPECT_FALSE(resizer->snap_phantom_window_controller_.get()); |
| 1885 | 1885 |
| 1886 // The pointer is on the edge but not shared. The snap phantom window | 1886 // The pointer is on the edge but not shared. The snap phantom window |
| 1887 // controller should be non-NULL. | 1887 // controller should be non-NULL. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1970 RunAnimationTillComplete(phantom_controller->animation_.get()); | 1970 RunAnimationTillComplete(phantom_controller->animation_.get()); |
| 1971 | 1971 |
| 1972 // Hide phantom controller. Both widgets should close. | 1972 // Hide phantom controller. Both widgets should close. |
| 1973 phantom_controller->Hide(); | 1973 phantom_controller->Hide(); |
| 1974 EXPECT_FALSE(phantom_controller->phantom_widget_); | 1974 EXPECT_FALSE(phantom_controller->phantom_widget_); |
| 1975 EXPECT_FALSE(phantom_controller->phantom_widget_start_); | 1975 EXPECT_FALSE(phantom_controller->phantom_widget_start_); |
| 1976 } | 1976 } |
| 1977 | 1977 |
| 1978 } // namespace internal | 1978 } // namespace internal |
| 1979 } // namespace ash | 1979 } // namespace ash |
| OLD | NEW |