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

Unified Diff: ash/wm/workspace/workspace_window_resizer_unittest.cc

Issue 23471004: Only support left/right maximizing at 50% width when the --ash-enable-alternate-caption-button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/workspace/workspace_window_resizer_unittest.cc
diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc
index 8459c54ef5f722b477b46a49b884fafba5f265f5..e10ed2fe0946ab50c44773ecec62495835d69c1a 100644
--- a/ash/wm/workspace/workspace_window_resizer_unittest.cc
+++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc
@@ -545,13 +545,19 @@ TEST_F(WorkspaceWindowResizerTest, Edge) {
ScreenAsh::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom();
window_->SetBounds(gfx::Rect(20, 30, 50, 60));
{
+ // Construct a SnapSizer to get the expected bounds when snapped left.
+ internal::SnapSizer sizer(window_.get(),
+ gfx::Point(),
+ internal::SnapSizer::LEFT_EDGE,
+ internal::SnapSizer::STEP_NO);
+
scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
window_.get(), gfx::Point(), HTCAPTION,
aura::client::WINDOW_MOVE_SOURCE_MOUSE, empty_windows()));
ASSERT_TRUE(resizer.get());
resizer->Drag(CalculateDragPoint(*resizer, 0, 10), 0);
resizer->CompleteDrag(0);
- EXPECT_EQ("0,0 720x" + base::IntToString(bottom),
+ EXPECT_EQ(sizer.target_bounds().ToString(),
window_->bounds().ToString());
ASSERT_TRUE(GetRestoreBoundsInScreen(window_.get()));
EXPECT_EQ("20,30 50x60",
@@ -559,13 +565,19 @@ TEST_F(WorkspaceWindowResizerTest, Edge) {
}
// Try the same with the right side.
{
+ // Construct a SnapSizer to get the expected bounds when snapped right.
+ internal::SnapSizer sizer(window_.get(),
+ gfx::Point(),
+ internal::SnapSizer::RIGHT_EDGE,
+ internal::SnapSizer::STEP_NO);
+
scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
window_.get(), gfx::Point(), HTCAPTION,
aura::client::WINDOW_MOVE_SOURCE_MOUSE, empty_windows()));
ASSERT_TRUE(resizer.get());
resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0);
resizer->CompleteDrag(0);
- EXPECT_EQ("80,0 720x" + base::IntToString(bottom),
+ EXPECT_EQ(sizer.target_bounds().ToString(),
window_->bounds().ToString());
ASSERT_TRUE(GetRestoreBoundsInScreen(window_.get()));
EXPECT_EQ("20,30 50x60",
@@ -1141,43 +1153,6 @@ TEST_F(WorkspaceWindowResizerTest, CtrlCompleteDragMoveToExactPosition) {
EXPECT_EQ("106,124 320x160", window_->bounds().ToString());
}
-// Check that only usable sizes get returned by the resizer.
-TEST_F(WorkspaceWindowResizerTest, TestProperSizerResolutions) {
- // Check that we have the correct work area resolution which fits our
- // expected test result.
- gfx::Rect work_area(ScreenAsh::GetDisplayWorkAreaBoundsInParent(
- window_.get()));
- EXPECT_EQ(800, work_area.width());
-
- window_->SetBounds(gfx::Rect(96, 112, 320, 160));
- scoped_ptr<SnapSizer> resizer(new SnapSizer(
- window_.get(),
- gfx::Point(),
- SnapSizer::LEFT_EDGE,
- SnapSizer::OTHER_INPUT));
- ASSERT_TRUE(resizer.get());
- shelf_layout_manager()->SetAutoHideBehavior(
- SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
-
- // Check that the list is declining and contains elements of the
- // ideal size list [1280, 1024, 768, 640] as well as 50% and 90% the work
- // area.
- gfx::Rect rect = resizer->GetTargetBoundsForSize(0);
- EXPECT_EQ("0,0 720x597", rect.ToString());
- rect = resizer->GetTargetBoundsForSize(1);
- EXPECT_EQ("0,0 640x597", rect.ToString());
- rect = resizer->GetTargetBoundsForSize(2);
- EXPECT_EQ("0,0 400x597", rect.ToString());
- shelf_layout_manager()->SetAutoHideBehavior(
- SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
- rect = resizer->GetTargetBoundsForSize(0);
- EXPECT_EQ("0,0 720x552", rect.ToString());
- rect = resizer->GetTargetBoundsForSize(1);
- EXPECT_EQ("0,0 640x552", rect.ToString());
- rect = resizer->GetTargetBoundsForSize(2);
- EXPECT_EQ("0,0 400x552", rect.ToString());
-}
-
// Verifies that a dragged window will restore to its pre-maximized size.
TEST_F(WorkspaceWindowResizerTest, RestoreToPreMaximizeCoordinates) {
window_->SetBounds(gfx::Rect(0, 0, 1000, 1000));
« ash/wm/workspace/snap_sizer.cc ('K') | « ash/wm/workspace/workspace_window_resizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698