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

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

Issue 2700523004: Remove docked windows entirely in M59. (Closed)
Patch Set: Rebase and fix 1 test Created 3 years, 10 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
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/common/wm/workspace/workspace_window_resizer.h" 5 #include "ash/common/wm/workspace/workspace_window_resizer.h"
6 6
7 #include "ash/common/ash_switches.h"
8 #include "ash/common/shelf/shelf_constants.h" 7 #include "ash/common/shelf/shelf_constants.h"
9 #include "ash/common/shelf/wm_shelf.h" 8 #include "ash/common/shelf/wm_shelf.h"
10 #include "ash/common/wm/window_positioning_utils.h" 9 #include "ash/common/wm/window_positioning_utils.h"
11 #include "ash/common/wm/window_state.h" 10 #include "ash/common/wm/window_state.h"
12 #include "ash/common/wm/wm_event.h" 11 #include "ash/common/wm/wm_event.h"
13 #include "ash/common/wm/workspace/phantom_window_controller.h" 12 #include "ash/common/wm/workspace/phantom_window_controller.h"
14 #include "ash/common/wm/workspace_controller.h" 13 #include "ash/common/wm/workspace_controller.h"
15 #include "ash/common/wm_window.h" 14 #include "ash/common/wm_window.h"
16 #include "ash/public/cpp/shell_window_ids.h" 15 #include "ash/public/cpp/shell_window_ids.h"
17 #include "ash/screen_util.h" 16 #include "ash/screen_util.h"
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 EXPECT_EQ(401, window_->bounds().width()); 1475 EXPECT_EQ(401, window_->bounds().width());
1477 EXPECT_EQ(302, window_->bounds().height()); 1476 EXPECT_EQ(302, window_->bounds().height());
1478 } 1477 }
1479 1478
1480 // Test that a window with a specified max size can't be snapped. 1479 // Test that a window with a specified max size can't be snapped.
1481 TEST_F(WorkspaceWindowResizerTest, PhantomSnapMaxSize) { 1480 TEST_F(WorkspaceWindowResizerTest, PhantomSnapMaxSize) {
1482 // Make the window snappable by making it resizable and maximizable. 1481 // Make the window snappable by making it resizable and maximizable.
1483 window_->SetProperty(aura::client::kResizeBehaviorKey, 1482 window_->SetProperty(aura::client::kResizeBehaviorKey,
1484 ui::mojom::kResizeBehaviorCanResize | 1483 ui::mojom::kResizeBehaviorCanResize |
1485 ui::mojom::kResizeBehaviorCanMaximize); 1484 ui::mojom::kResizeBehaviorCanMaximize);
1486
1487 // Enable docking for this test.
1488 base::CommandLine::ForCurrentProcess()->AppendSwitch(
1489 ash::switches::kAshEnableDockedWindows);
1490
1491 { 1485 {
1492 // With max size not set we get a phantom window controller for dragging off 1486 // With max size not set we get a phantom window controller for dragging off
1493 // the right hand side. 1487 // the right hand side.
1494 // Make the window wider than maximum docked width. 1488 // Make the window wider than maximum docked width.
1495 window_->SetBounds(gfx::Rect(0, 0, 400, 200)); 1489 window_->SetBounds(gfx::Rect(0, 0, 400, 200));
1496 1490
1497 std::unique_ptr<WindowResizer> resizer( 1491 std::unique_ptr<WindowResizer> resizer(
1498 CreateResizerForTest(window_.get(), gfx::Point(), HTCAPTION)); 1492 CreateResizerForTest(window_.get(), gfx::Point(), HTCAPTION));
1499 EXPECT_FALSE(snap_phantom_window_controller()); 1493 EXPECT_FALSE(snap_phantom_window_controller());
1500 resizer->Drag(CalculateDragPoint(*resizer, 801, 0), 0); 1494 resizer->Drag(CalculateDragPoint(*resizer, 801, 0), 0);
1501 EXPECT_TRUE(snap_phantom_window_controller()); 1495 EXPECT_TRUE(snap_phantom_window_controller());
1502 resizer->RevertDrag(); 1496 resizer->RevertDrag();
1503 } 1497 }
1504 { 1498 {
1505 // With max size defined, we get no phantom window for snapping but we still 1499 // With max size defined, we get no phantom window for snapping.
1506 // get a phantom window (docking guide).
1507 window_->SetBounds(gfx::Rect(0, 0, 400, 200)); 1500 window_->SetBounds(gfx::Rect(0, 0, 400, 200));
1508 delegate_.set_max_size(gfx::Size(400, 200)); 1501 delegate_.set_max_size(gfx::Size(400, 200));
1509 1502
1510 std::unique_ptr<WindowResizer> resizer( 1503 std::unique_ptr<WindowResizer> resizer(
1511 CreateResizerForTest(window_.get(), gfx::Point(), HTCAPTION)); 1504 CreateResizerForTest(window_.get(), gfx::Point(), HTCAPTION));
1512 resizer->Drag(CalculateDragPoint(*resizer, 801, 0), 0); 1505 resizer->Drag(CalculateDragPoint(*resizer, 801, 0), 0);
1513 EXPECT_TRUE(snap_phantom_window_controller()); 1506 EXPECT_FALSE(snap_phantom_window_controller());
1514 resizer->RevertDrag(); 1507 resizer->RevertDrag();
1515 } 1508 }
1516 { 1509 {
1517 // With max size defined, we get no phantom window for snapping. 1510 // With max size defined, we get no phantom window for snapping.
1518 window_->SetBounds(gfx::Rect(0, 0, 400, 200)); 1511 window_->SetBounds(gfx::Rect(0, 0, 400, 200));
1519 delegate_.set_max_size(gfx::Size(400, 200)); 1512 delegate_.set_max_size(gfx::Size(400, 200));
1520 // With min size defined, we get no phantom window for docking. 1513 // With min size defined, we get no phantom window for docking.
1521 delegate_.set_min_size(gfx::Size(400, 200)); 1514 delegate_.set_min_size(gfx::Size(400, 200));
1522 1515
1523 std::unique_ptr<WindowResizer> resizer( 1516 std::unique_ptr<WindowResizer> resizer(
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 touch_resize_window_->bounds().ToString()); 1861 touch_resize_window_->bounds().ToString());
1869 // Drag even more to snap to the edge. 1862 // Drag even more to snap to the edge.
1870 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), 1863 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40),
1871 gfx::Point(400, kRootHeight - 25), 1864 gfx::Point(400, kRootHeight - 25),
1872 base::TimeDelta::FromMilliseconds(10), 5); 1865 base::TimeDelta::FromMilliseconds(10), 5);
1873 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), 1866 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(),
1874 touch_resize_window_->bounds().ToString()); 1867 touch_resize_window_->bounds().ToString());
1875 } 1868 }
1876 1869
1877 } // namespace ash 1870 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698