| 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/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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 UpdateDisplay("800x700"); | 559 UpdateDisplay("800x700"); |
| 560 // TODO(varkha): Insets are reset after every drag because of | 560 // TODO(varkha): Insets are reset after every drag because of |
| 561 // http://crbug.com/292238. | 561 // http://crbug.com/292238. |
| 562 // Window is wide enough not to get docked right away. | 562 // Window is wide enough not to get docked right away. |
| 563 window_->SetBounds(gfx::Rect(20, 30, 400, 60)); | 563 window_->SetBounds(gfx::Rect(20, 30, 400, 60)); |
| 564 window_->SetProperty(aura::client::kCanMaximizeKey, true); | 564 window_->SetProperty(aura::client::kCanMaximizeKey, true); |
| 565 wm::WindowState* window_state = wm::GetWindowState(window_.get()); | 565 wm::WindowState* window_state = wm::GetWindowState(window_.get()); |
| 566 | 566 |
| 567 { | 567 { |
| 568 gfx::Rect expected_bounds_in_parent( | 568 gfx::Rect expected_bounds_in_parent( |
| 569 wm::GetDefaultLeftSnappedWindowBoundsInParent(window_.get())); | 569 wm::GetDefaultLeftSnappedWindowBoundsInParent( |
| 570 wm::WmWindowAura::Get(window_.get()))); |
| 570 | 571 |
| 571 std::unique_ptr<WindowResizer> resizer( | 572 std::unique_ptr<WindowResizer> resizer( |
| 572 CreateResizerForTest(window_.get(), gfx::Point(), HTCAPTION)); | 573 CreateResizerForTest(window_.get(), gfx::Point(), HTCAPTION)); |
| 573 ASSERT_TRUE(resizer.get()); | 574 ASSERT_TRUE(resizer.get()); |
| 574 resizer->Drag(CalculateDragPoint(*resizer, 0, 10), 0); | 575 resizer->Drag(CalculateDragPoint(*resizer, 0, 10), 0); |
| 575 resizer->CompleteDrag(); | 576 resizer->CompleteDrag(); |
| 576 | 577 |
| 577 EXPECT_EQ(expected_bounds_in_parent.ToString(), | 578 EXPECT_EQ(expected_bounds_in_parent.ToString(), |
| 578 window_->bounds().ToString()); | 579 window_->bounds().ToString()); |
| 579 ASSERT_TRUE(window_state->HasRestoreBounds()); | 580 ASSERT_TRUE(window_state->HasRestoreBounds()); |
| 580 EXPECT_EQ("20,30 400x60", | 581 EXPECT_EQ("20,30 400x60", |
| 581 window_state->GetRestoreBoundsInScreen().ToString()); | 582 window_state->GetRestoreBoundsInScreen().ToString()); |
| 582 } | 583 } |
| 583 // Try the same with the right side. | 584 // Try the same with the right side. |
| 584 { | 585 { |
| 585 gfx::Rect expected_bounds_in_parent( | 586 gfx::Rect expected_bounds_in_parent( |
| 586 wm::GetDefaultRightSnappedWindowBoundsInParent(window_.get())); | 587 wm::GetDefaultRightSnappedWindowBoundsInParent( |
| 588 wm::WmWindowAura::Get(window_.get()))); |
| 587 | 589 |
| 588 std::unique_ptr<WindowResizer> resizer( | 590 std::unique_ptr<WindowResizer> resizer( |
| 589 CreateResizerForTest(window_.get(), gfx::Point(), HTCAPTION)); | 591 CreateResizerForTest(window_.get(), gfx::Point(), HTCAPTION)); |
| 590 ASSERT_TRUE(resizer.get()); | 592 ASSERT_TRUE(resizer.get()); |
| 591 resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0); | 593 resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0); |
| 592 resizer->CompleteDrag(); | 594 resizer->CompleteDrag(); |
| 593 EXPECT_EQ(expected_bounds_in_parent.ToString(), | 595 EXPECT_EQ(expected_bounds_in_parent.ToString(), |
| 594 window_->bounds().ToString()); | 596 window_->bounds().ToString()); |
| 595 ASSERT_TRUE(window_state->HasRestoreBounds()); | 597 ASSERT_TRUE(window_state->HasRestoreBounds()); |
| 596 EXPECT_EQ("20,30 400x60", | 598 EXPECT_EQ("20,30 400x60", |
| (...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1884 // Drag even more to snap to the edge. | 1886 // Drag even more to snap to the edge. |
| 1885 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), | 1887 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), |
| 1886 gfx::Point(400, kRootHeight - 25), | 1888 gfx::Point(400, kRootHeight - 25), |
| 1887 base::TimeDelta::FromMilliseconds(10), | 1889 base::TimeDelta::FromMilliseconds(10), |
| 1888 5); | 1890 5); |
| 1889 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), | 1891 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), |
| 1890 touch_resize_window_->bounds().ToString()); | 1892 touch_resize_window_->bounds().ToString()); |
| 1891 } | 1893 } |
| 1892 | 1894 |
| 1893 } // namespace ash | 1895 } // namespace ash |
| OLD | NEW |