| 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 "base/memory/scoped_ptr.h" | 7 #include <memory> | 
|  | 8 | 
| 8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" | 
| 9 | 10 | 
| 10 namespace { | 11 namespace { | 
| 11 | 12 | 
| 12 const int kScreenWidth = 800; | 13 const int kScreenWidth = 800; | 
| 13 const int kScreenHeight = 600; | 14 const int kScreenHeight = 600; | 
| 14 | 15 | 
| 15 const int kWindowWidth = 100; | 16 const int kWindowWidth = 100; | 
| 16 const int kWindowHeight = 200; | 17 const int kWindowHeight = 200; | 
| 17 | 18 | 
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 108     return positioner_->GetShelfEdge(shelf_rect); | 109     return positioner_->GetShelfEdge(shelf_rect); | 
| 109   } | 110   } | 
| 110 | 111 | 
| 111   int DoGetCursorDistanceFromShelf( | 112   int DoGetCursorDistanceFromShelf( | 
| 112       AppListPositioner::ScreenEdge shelf_edge) const { | 113       AppListPositioner::ScreenEdge shelf_edge) const { | 
| 113     return positioner_->GetCursorDistanceFromShelf(shelf_edge, cursor_); | 114     return positioner_->GetCursorDistanceFromShelf(shelf_edge, cursor_); | 
| 114   } | 115   } | 
| 115 | 116 | 
| 116  private: | 117  private: | 
| 117   gfx::Display display_; | 118   gfx::Display display_; | 
| 118   scoped_ptr<AppListPositioner> positioner_; | 119   std::unique_ptr<AppListPositioner> positioner_; | 
| 119   gfx::Point cursor_; | 120   gfx::Point cursor_; | 
| 120 }; | 121 }; | 
| 121 | 122 | 
| 122 TEST_F(AppListPositionerUnitTest, ScreenCorner) { | 123 TEST_F(AppListPositionerUnitTest, ScreenCorner) { | 
| 123   // Position the app list in a corner of the screen. | 124   // Position the app list in a corner of the screen. | 
| 124   // Top-left corner. | 125   // Top-left corner. | 
| 125   EXPECT_EQ(gfx::Point(kWindowWidth / 2 + kMinDistanceFromEdge, | 126   EXPECT_EQ(gfx::Point(kWindowWidth / 2 + kMinDistanceFromEdge, | 
| 126                        kMenuBarSize + kWindowHeight / 2 + kMinDistanceFromEdge), | 127                        kMenuBarSize + kWindowHeight / 2 + kMinDistanceFromEdge), | 
| 127             DoGetAnchorPointForScreenCorner( | 128             DoGetAnchorPointForScreenCorner( | 
| 128                 AppListPositioner::SCREEN_CORNER_TOP_LEFT)); | 129                 AppListPositioner::SCREEN_CORNER_TOP_LEFT)); | 
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 329   EXPECT_EQ( | 330   EXPECT_EQ( | 
| 330       kWindowAwayFromEdge - kShelfSize, | 331       kWindowAwayFromEdge - kShelfSize, | 
| 331       DoGetCursorDistanceFromShelf(AppListPositioner::SCREEN_EDGE_BOTTOM)); | 332       DoGetCursorDistanceFromShelf(AppListPositioner::SCREEN_EDGE_BOTTOM)); | 
| 332 | 333 | 
| 333   // Shelf on bottom. Cursor inside shelf; expect 0. | 334   // Shelf on bottom. Cursor inside shelf; expect 0. | 
| 334   PlaceShelf(AppListPositioner::SCREEN_EDGE_BOTTOM); | 335   PlaceShelf(AppListPositioner::SCREEN_EDGE_BOTTOM); | 
| 335   PlaceCursor(kCursorIgnore, kScreenHeight - kCursorOnShelf); | 336   PlaceCursor(kCursorIgnore, kScreenHeight - kCursorOnShelf); | 
| 336   EXPECT_EQ( | 337   EXPECT_EQ( | 
| 337       0, DoGetCursorDistanceFromShelf(AppListPositioner::SCREEN_EDGE_BOTTOM)); | 338       0, DoGetCursorDistanceFromShelf(AppListPositioner::SCREEN_EDGE_BOTTOM)); | 
| 338 } | 339 } | 
| OLD | NEW | 
|---|