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

Unified Diff: chrome/browser/ui/app_list/app_list_service_mac_unittest.mm

Issue 93863002: Mac App Launcher is positioned on center of dock in certain cases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Goddamn Reitveld. Created 7 years, 1 month 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: chrome/browser/ui/app_list/app_list_service_mac_unittest.mm
diff --git a/chrome/browser/ui/app_list/app_list_service_mac_unittest.mm b/chrome/browser/ui/app_list/app_list_service_mac_unittest.mm
index 6799b786452a554136d1e831c7698fb07bdeca46..accbea5dc20cd59e950e0afb9a9f4bca438c5470 100644
--- a/chrome/browser/ui/app_list/app_list_service_mac_unittest.mm
+++ b/chrome/browser/ui/app_list/app_list_service_mac_unittest.mm
@@ -131,25 +131,32 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointNoCursor) {
NSPoint target_origin;
NSPoint start_origin;
- // Bottom dock. Expect the app list to be in the bottom-left corner, above the
- // dock.
+ // Bottom dock. Expect the app list to be centered on the dock.
PlaceDock(DOCK_LOCATION_BOTTOM, false);
DoFindAnchorPoint(&target_origin, &start_origin);
- EXPECT_TRUE(NSEqualPoints(NSMakePoint(0, kDockSize), target_origin));
- EXPECT_TRUE(NSEqualPoints(target_origin, start_origin));
+ EXPECT_TRUE(
+ NSEqualPoints(NSMakePoint(kScreenWidth / 2 - kWindowWidth / 2, kDockSize),
+ target_origin));
+ EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, 0, -kAnimationOffset),
+ start_origin));
- // Left dock. Expect the app list to be in the bottom-left corner, beside the
- // dock.
+ // Left dock. Expect the app list to be centered on the dock.
PlaceDock(DOCK_LOCATION_LEFT, false);
DoFindAnchorPoint(&target_origin, &start_origin);
- EXPECT_TRUE(NSEqualPoints(NSMakePoint(kDockSize, 0), target_origin));
- EXPECT_TRUE(NSEqualPoints(target_origin, start_origin));
+ EXPECT_TRUE(NSEqualPoints(
+ NSMakePoint(kDockSize, kScreenHeight / 2 - kWindowHeight / 2),
+ target_origin));
+ EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, -kAnimationOffset, 0),
+ start_origin));
- // Right dock. Expect the app list to be in the bottom-left corner.
+ // Right dock. Expect the app list to be centered on the dock.
PlaceDock(DOCK_LOCATION_RIGHT, false);
DoFindAnchorPoint(&target_origin, &start_origin);
- EXPECT_TRUE(NSEqualPoints(NSMakePoint(0, 0), target_origin));
- EXPECT_TRUE(NSEqualPoints(target_origin, start_origin));
+ EXPECT_TRUE(NSEqualPoints(NSMakePoint(kScreenWidth - kDockSize - kWindowWidth,
+ kScreenHeight / 2 - kWindowHeight / 2),
+ target_origin));
+ EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, kAnimationOffset, 0),
+ start_origin));
}
// Tests positioning the app list when there is no dock on the display.
@@ -167,43 +174,37 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointNoDock) {
// Tests positioning the app list when the mouse is away from the dock.
TEST_F(AppListServiceMacUnitTest, FindAnchorPointMouseOffDock) {
- // On Mac, this is currently no different from having the mouse on the dock.
SetCursorVisible(true);
NSPoint target_origin;
NSPoint start_origin;
- // Bottom dock. Expect the app list to be at the bottom centered on the mouse
- // X coordinate.
+ // Bottom dock. Expect the app list to be centered on the dock.
PlaceDock(DOCK_LOCATION_BOTTOM, false);
PlaceCursor(kWindowAwayFromEdge, kScreenHeight - kCursorAwayFromDock);
DoFindAnchorPoint(&target_origin, &start_origin);
- EXPECT_TRUE(NSEqualPoints(
- NSMakePoint(kWindowAwayFromEdge - kWindowWidth / 2, kDockSize),
- target_origin));
+ EXPECT_TRUE(
+ NSEqualPoints(NSMakePoint(kScreenWidth / 2 - kWindowWidth / 2, kDockSize),
+ target_origin));
EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, 0, -kAnimationOffset),
start_origin));
- // Left dock. Expect the app list to be at the left centered on the mouse Y
- // coordinate.
+ // Left dock. Expect the app list to be centered on the dock.
PlaceDock(DOCK_LOCATION_LEFT, false);
PlaceCursor(kCursorAwayFromDock, kWindowAwayFromEdge);
DoFindAnchorPoint(&target_origin, &start_origin);
EXPECT_TRUE(NSEqualPoints(
- NSMakePoint(kDockSize,
- kScreenHeight - kWindowAwayFromEdge - kWindowHeight / 2),
+ NSMakePoint(kDockSize, kScreenHeight / 2 - kWindowHeight / 2),
target_origin));
EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, -kAnimationOffset, 0),
start_origin));
- // Right dock. Expect the app list to be at the right centered on the mouse Y
- // coordinate.
+ // Right dock. Expect the app list to be centered on the dock.
PlaceDock(DOCK_LOCATION_RIGHT, false);
PlaceCursor(kScreenWidth - kCursorAwayFromDock, kWindowAwayFromEdge);
DoFindAnchorPoint(&target_origin, &start_origin);
- EXPECT_TRUE(NSEqualPoints(
- NSMakePoint(kScreenWidth - kDockSize - kWindowWidth,
- kScreenHeight - kWindowAwayFromEdge - kWindowHeight / 2),
- target_origin));
+ EXPECT_TRUE(NSEqualPoints(NSMakePoint(kScreenWidth - kDockSize - kWindowWidth,
+ kScreenHeight / 2 - kWindowHeight / 2),
+ target_origin));
EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, kAnimationOffset, 0),
start_origin));
}

Powered by Google App Engine
This is Rietveld 408576698