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 #import "chrome/browser/ui/app_list/app_list_service_mac.h" | 5 #import "chrome/browser/ui/app_list/app_list_service_mac.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "ui/gfx/display.h" | 8 #include "ui/gfx/display.h" |
9 #include "ui/gfx/geometry/point.h" | 9 #include "ui/gfx/geometry/point.h" |
10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 // Returns |point| offset by (|x_offset|, |y_offset|). | 59 // Returns |point| offset by (|x_offset|, |y_offset|). |
60 NSPoint OffsetPoint(const NSPoint& point, CGFloat x_offset, CGFloat y_offset) { | 60 NSPoint OffsetPoint(const NSPoint& point, CGFloat x_offset, CGFloat y_offset) { |
61 return NSMakePoint(point.x + x_offset, point.y + y_offset); | 61 return NSMakePoint(point.x + x_offset, point.y + y_offset); |
62 } | 62 } |
63 | 63 |
64 } // namespace | 64 } // namespace |
65 | 65 |
66 class AppListServiceMacUnitTest : public testing::Test { | 66 class AppListServiceMacUnitTest : public testing::Test { |
67 public: | 67 public: |
68 virtual void SetUp() override { | 68 void SetUp() override { |
69 display_.set_bounds(gfx::Rect(0, 0, kScreenWidth, kScreenHeight)); | 69 display_.set_bounds(gfx::Rect(0, 0, kScreenWidth, kScreenHeight)); |
70 display_.set_work_area( | 70 display_.set_work_area( |
71 gfx::Rect(0, kMenuBarSize, kScreenWidth, kScreenHeight - kMenuBarSize)); | 71 gfx::Rect(0, kMenuBarSize, kScreenWidth, kScreenHeight - kMenuBarSize)); |
72 window_size_ = gfx::Size(kWindowWidth, kWindowHeight); | 72 window_size_ = gfx::Size(kWindowWidth, kWindowHeight); |
73 cursor_is_visible_ = true; | 73 cursor_is_visible_ = true; |
74 cursor_ = gfx::Point(); | 74 cursor_ = gfx::Point(); |
75 } | 75 } |
76 | 76 |
77 // Sets up the test environment with the dock in a given location. | 77 // Sets up the test environment with the dock in a given location. |
78 void PlaceDock(DockLocation location, bool hidden) { | 78 void PlaceDock(DockLocation location, bool hidden) { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 328 |
329 // Bottom dock. Mouse near right edge. App list must not go off screen. | 329 // Bottom dock. Mouse near right edge. App list must not go off screen. |
330 PlaceDock(DOCK_LOCATION_BOTTOM, false); | 330 PlaceDock(DOCK_LOCATION_BOTTOM, false); |
331 PlaceCursor(kScreenWidth - kWindowNearEdge, kScreenHeight - kCursorOnDock); | 331 PlaceCursor(kScreenWidth - kWindowNearEdge, kScreenHeight - kCursorOnDock); |
332 DoFindAnchorPoint(&target_origin, &start_origin); | 332 DoFindAnchorPoint(&target_origin, &start_origin); |
333 EXPECT_TRUE(NSEqualPoints(NSMakePoint(kScreenWidth - kWindowWidth, kDockSize), | 333 EXPECT_TRUE(NSEqualPoints(NSMakePoint(kScreenWidth - kWindowWidth, kDockSize), |
334 target_origin)); | 334 target_origin)); |
335 EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, 0, -kAnimationOffset), | 335 EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, 0, -kAnimationOffset), |
336 start_origin)); | 336 start_origin)); |
337 } | 337 } |
OLD | NEW |