| 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 "base/memory/scoped_ptr.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } // namespace | 39 } // namespace |
| 40 | 40 |
| 41 class AppListPositionerUnitTest : public testing::Test { | 41 class AppListPositionerUnitTest : public testing::Test { |
| 42 public: | 42 public: |
| 43 void ResetPositioner() { | 43 void ResetPositioner() { |
| 44 gfx::Size view_size(kWindowWidth, kWindowHeight); | 44 gfx::Size view_size(kWindowWidth, kWindowHeight); |
| 45 positioner_.reset( | 45 positioner_.reset( |
| 46 new AppListPositioner(display_, view_size, kMinDistanceFromEdge)); | 46 new AppListPositioner(display_, view_size, kMinDistanceFromEdge)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 virtual void SetUp() OVERRIDE { | 49 virtual void SetUp() override { |
| 50 display_.set_bounds(gfx::Rect(0, 0, kScreenWidth, kScreenHeight)); | 50 display_.set_bounds(gfx::Rect(0, 0, kScreenWidth, kScreenHeight)); |
| 51 // Assume there is a menu bar at the top of the screen, as on Mac and Unity. | 51 // Assume there is a menu bar at the top of the screen, as on Mac and Unity. |
| 52 // This is for cases where the work area does not fill the entire screen. | 52 // This is for cases where the work area does not fill the entire screen. |
| 53 display_.set_work_area( | 53 display_.set_work_area( |
| 54 gfx::Rect(0, kMenuBarSize, kScreenWidth, kScreenHeight - kMenuBarSize)); | 54 gfx::Rect(0, kMenuBarSize, kScreenWidth, kScreenHeight - kMenuBarSize)); |
| 55 ResetPositioner(); | 55 ResetPositioner(); |
| 56 cursor_ = gfx::Point(); | 56 cursor_ = gfx::Point(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Sets up the test environment with the shelf along a given edge of the work | 59 // Sets up the test environment with the shelf along a given edge of the work |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 EXPECT_EQ( | 329 EXPECT_EQ( |
| 330 kWindowAwayFromEdge - kShelfSize, | 330 kWindowAwayFromEdge - kShelfSize, |
| 331 DoGetCursorDistanceFromShelf(AppListPositioner::SCREEN_EDGE_BOTTOM)); | 331 DoGetCursorDistanceFromShelf(AppListPositioner::SCREEN_EDGE_BOTTOM)); |
| 332 | 332 |
| 333 // Shelf on bottom. Cursor inside shelf; expect 0. | 333 // Shelf on bottom. Cursor inside shelf; expect 0. |
| 334 PlaceShelf(AppListPositioner::SCREEN_EDGE_BOTTOM); | 334 PlaceShelf(AppListPositioner::SCREEN_EDGE_BOTTOM); |
| 335 PlaceCursor(kCursorIgnore, kScreenHeight - kCursorOnShelf); | 335 PlaceCursor(kCursorIgnore, kScreenHeight - kCursorOnShelf); |
| 336 EXPECT_EQ( | 336 EXPECT_EQ( |
| 337 0, DoGetCursorDistanceFromShelf(AppListPositioner::SCREEN_EDGE_BOTTOM)); | 337 0, DoGetCursorDistanceFromShelf(AppListPositioner::SCREEN_EDGE_BOTTOM)); |
| 338 } | 338 } |
| OLD | NEW |