Index: chrome/browser/ui/app_list/app_list_positioner_unittest.cc |
diff --git a/chrome/browser/ui/app_list/app_list_positioner_unittest.cc b/chrome/browser/ui/app_list/app_list_positioner_unittest.cc |
index f002f48507ac34c8beb042ab2629e9946fb1736d..64fc157882eb511a22dda006e6ba3a7181f700c6 100644 |
--- a/chrome/browser/ui/app_list/app_list_positioner_unittest.cc |
+++ b/chrome/browser/ui/app_list/app_list_positioner_unittest.cc |
@@ -88,6 +88,11 @@ class AppListPositionerUnitTest : public testing::Test { |
return positioner_->GetAnchorPointForShelfCorner(shelf_edge); |
} |
+ gfx::Point DoGetAnchorPointForShelfCenter( |
+ AppListPositioner::ScreenEdge shelf_edge) const { |
+ return positioner_->GetAnchorPointForShelfCenter(shelf_edge); |
+ } |
+ |
gfx::Point DoGetAnchorPointForShelfCursor( |
AppListPositioner::ScreenEdge shelf_edge) const { |
return positioner_->GetAnchorPointForShelfCursor(shelf_edge, cursor_); |
@@ -170,6 +175,33 @@ TEST_F(AppListPositionerUnitTest, ShelfCorner) { |
DoGetAnchorPointForShelfCorner(AppListPositioner::SCREEN_EDGE_BOTTOM)); |
} |
+TEST_F(AppListPositionerUnitTest, ShelfCenter) { |
+ // Position the app list on the shelf, aligned with the shelf center. |
+ PlaceShelf(AppListPositioner::SCREEN_EDGE_LEFT); |
+ // Shelf on left. Expect app list to be center-left. |
+ EXPECT_EQ( |
+ gfx::Point(83, kScreenHeight / 2), |
+ DoGetAnchorPointForShelfCenter(AppListPositioner::SCREEN_EDGE_LEFT)); |
+ |
+ // Shelf on right. Expect app list to be center-right. |
+ PlaceShelf(AppListPositioner::SCREEN_EDGE_RIGHT); |
+ EXPECT_EQ( |
+ gfx::Point(kScreenWidth - 83, kScreenHeight / 2), |
+ DoGetAnchorPointForShelfCenter(AppListPositioner::SCREEN_EDGE_RIGHT)); |
+ |
+ // Shelf on top. Expect app list to be top-center. |
+ PlaceShelf(AppListPositioner::SCREEN_EDGE_TOP); |
+ EXPECT_EQ( |
+ gfx::Point(kScreenWidth / 2, 133), |
+ DoGetAnchorPointForShelfCenter(AppListPositioner::SCREEN_EDGE_TOP)); |
+ |
+ // Shelf on bottom. Expect app list to be bottom-center. |
+ PlaceShelf(AppListPositioner::SCREEN_EDGE_BOTTOM); |
+ EXPECT_EQ( |
+ gfx::Point(kScreenWidth / 2, kScreenHeight - 133), |
+ DoGetAnchorPointForShelfCenter(AppListPositioner::SCREEN_EDGE_BOTTOM)); |
+} |
+ |
TEST_F(AppListPositionerUnitTest, ShelfCursor) { |
// Position the app list on the shelf, aligned with the mouse cursor. |