OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/app_list/app_list_positioner.h" | 5 #include "chrome/browser/ui/app_list/app_list_positioner.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 const gfx::Rect& shelf_rect) const { | 108 const gfx::Rect& shelf_rect) const { |
109 return positioner_->GetShelfEdge(shelf_rect); | 109 return positioner_->GetShelfEdge(shelf_rect); |
110 } | 110 } |
111 | 111 |
112 int DoGetCursorDistanceFromShelf( | 112 int DoGetCursorDistanceFromShelf( |
113 AppListPositioner::ScreenEdge shelf_edge) const { | 113 AppListPositioner::ScreenEdge shelf_edge) const { |
114 return positioner_->GetCursorDistanceFromShelf(shelf_edge, cursor_); | 114 return positioner_->GetCursorDistanceFromShelf(shelf_edge, cursor_); |
115 } | 115 } |
116 | 116 |
117 private: | 117 private: |
118 gfx::Display display_; | 118 display::Display display_; |
119 std::unique_ptr<AppListPositioner> positioner_; | 119 std::unique_ptr<AppListPositioner> positioner_; |
120 gfx::Point cursor_; | 120 gfx::Point cursor_; |
121 }; | 121 }; |
122 | 122 |
123 TEST_F(AppListPositionerUnitTest, ScreenCorner) { | 123 TEST_F(AppListPositionerUnitTest, ScreenCorner) { |
124 // Position the app list in a corner of the screen. | 124 // Position the app list in a corner of the screen. |
125 // Top-left corner. | 125 // Top-left corner. |
126 EXPECT_EQ(gfx::Point(kWindowWidth / 2 + kMinDistanceFromEdge, | 126 EXPECT_EQ(gfx::Point(kWindowWidth / 2 + kMinDistanceFromEdge, |
127 kMenuBarSize + kWindowHeight / 2 + kMinDistanceFromEdge), | 127 kMenuBarSize + kWindowHeight / 2 + kMinDistanceFromEdge), |
128 DoGetAnchorPointForScreenCorner( | 128 DoGetAnchorPointForScreenCorner( |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 EXPECT_EQ( | 330 EXPECT_EQ( |
331 kWindowAwayFromEdge - kShelfSize, | 331 kWindowAwayFromEdge - kShelfSize, |
332 DoGetCursorDistanceFromShelf(AppListPositioner::SCREEN_EDGE_BOTTOM)); | 332 DoGetCursorDistanceFromShelf(AppListPositioner::SCREEN_EDGE_BOTTOM)); |
333 | 333 |
334 // Shelf on bottom. Cursor inside shelf; expect 0. | 334 // Shelf on bottom. Cursor inside shelf; expect 0. |
335 PlaceShelf(AppListPositioner::SCREEN_EDGE_BOTTOM); | 335 PlaceShelf(AppListPositioner::SCREEN_EDGE_BOTTOM); |
336 PlaceCursor(kCursorIgnore, kScreenHeight - kCursorOnShelf); | 336 PlaceCursor(kCursorIgnore, kScreenHeight - kCursorOnShelf); |
337 EXPECT_EQ( | 337 EXPECT_EQ( |
338 0, DoGetCursorDistanceFromShelf(AppListPositioner::SCREEN_EDGE_BOTTOM)); | 338 0, DoGetCursorDistanceFromShelf(AppListPositioner::SCREEN_EDGE_BOTTOM)); |
339 } | 339 } |
OLD | NEW |