summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorhshi@chromium.org <hshi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-27 08:09:54 +0000
committerhshi@chromium.org <hshi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-27 08:09:54 +0000
commit03d14d0eae08f152a8e74fb180f442a12a4da691 (patch)
tree98a310ebe07f83190cdd777c954df8aee4bf3691 /ash
parent181d0240ef04d3786800dd5f60aef886323e893f (diff)
downloadchromium_src-03d14d0eae08f152a8e74fb180f442a12a4da691.zip
chromium_src-03d14d0eae08f152a8e74fb180f442a12a4da691.tar.gz
chromium_src-03d14d0eae08f152a8e74fb180f442a12a4da691.tar.bz2
Re-land 184821 with updated unit tests.
Fix a minor typo in SnapSizer::GetSnapBounds(). The second operand for the "%" operator should be the array size of usable_width_, not the size minus 1. BUG=178561 TEST=manually tested Review URL: https://chromiumcodereview.appspot.com/12334113 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184906 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/accelerators/accelerator_controller_unittest.cc4
-rw-r--r--ash/wm/workspace/snap_sizer.cc2
2 files changed, 5 insertions, 1 deletions
diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc
index 8ce8727..ccc574d 100644
--- a/ash/accelerators/accelerator_controller_unittest.cc
+++ b/ash/accelerators/accelerator_controller_unittest.cc
@@ -437,6 +437,8 @@ TEST_F(AcceleratorControllerTest, WindowSnap) {
gfx::Rect snap_left = window->bounds();
GetController()->PerformAction(WINDOW_SNAP_LEFT, dummy);
EXPECT_NE(window->bounds().ToString(), snap_left.ToString());
+ GetController()->PerformAction(WINDOW_SNAP_LEFT, dummy);
+ EXPECT_NE(window->bounds().ToString(), snap_left.ToString());
// It should cycle back to the first snapped position.
GetController()->PerformAction(WINDOW_SNAP_LEFT, dummy);
@@ -447,6 +449,8 @@ TEST_F(AcceleratorControllerTest, WindowSnap) {
gfx::Rect snap_right = window->bounds();
GetController()->PerformAction(WINDOW_SNAP_RIGHT, dummy);
EXPECT_NE(window->bounds().ToString(), snap_right.ToString());
+ GetController()->PerformAction(WINDOW_SNAP_RIGHT, dummy);
+ EXPECT_NE(window->bounds().ToString(), snap_right.ToString());
// It should cycle back to the first snapped position.
GetController()->PerformAction(WINDOW_SNAP_RIGHT, dummy);
diff --git a/ash/wm/workspace/snap_sizer.cc b/ash/wm/workspace/snap_sizer.cc
index 5788481..11b5947 100644
--- a/ash/wm/workspace/snap_sizer.cc
+++ b/ash/wm/workspace/snap_sizer.cc
@@ -151,7 +151,7 @@ gfx::Rect SnapSizer::GetSnapBounds(const gfx::Rect& bounds) {
}
}
}
- return GetTargetBoundsForSize(current % (usable_width_.size() - 1));
+ return GetTargetBoundsForSize(current % usable_width_.size());
}
void SnapSizer::SelectDefaultSizeAndDisableResize() {