OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/touch_selection/touch_handle.h" | 5 #include "ui/touch_selection/touch_handle.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "ui/events/test/motion_event_test_utils.h" | 9 #include "ui/events/test/motion_event_test_utils.h" |
10 #include "ui/gfx/geometry/rect_f.h" | 10 #include "ui/gfx/geometry/rect_f.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 bool IsWithinTapSlop(const gfx::Vector2dF& delta) const override { | 103 bool IsWithinTapSlop(const gfx::Vector2dF& delta) const override { |
104 return delta.LengthSquared() < (kDefaultTapSlop * kDefaultTapSlop); | 104 return delta.LengthSquared() < (kDefaultTapSlop * kDefaultTapSlop); |
105 } | 105 } |
106 | 106 |
107 void OnHandleTapped(const TouchHandle& handle) override { tapped_ = true; } | 107 void OnHandleTapped(const TouchHandle& handle) override { tapped_ = true; } |
108 | 108 |
109 void SetNeedsAnimate() override { needs_animate_ = true; } | 109 void SetNeedsAnimate() override { needs_animate_ = true; } |
110 | 110 |
111 std::unique_ptr<TouchHandleDrawable> CreateDrawable() override { | 111 std::unique_ptr<TouchHandleDrawable> CreateDrawable() override { |
112 return base::WrapUnique(new MockTouchHandleDrawable(&drawable_data_)); | 112 return base::MakeUnique<MockTouchHandleDrawable>(&drawable_data_); |
113 } | 113 } |
114 | 114 |
115 base::TimeDelta GetMaxTapDuration() const override { | 115 base::TimeDelta GetMaxTapDuration() const override { |
116 return base::TimeDelta::FromMilliseconds(kDefaultTapDurationMs); | 116 return base::TimeDelta::FromMilliseconds(kDefaultTapDurationMs); |
117 } | 117 } |
118 | 118 |
119 bool IsAdaptiveHandleOrientationEnabled() const override { | 119 bool IsAdaptiveHandleOrientationEnabled() const override { |
120 // Enable adaptive handle orientation by default for unittests | 120 // Enable adaptive handle orientation by default for unittests |
121 return true; | 121 return true; |
122 } | 122 } |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 UpdateViewportRect(handle, gfx::RectF(0, 0, 230, 600)); | 679 UpdateViewportRect(handle, gfx::RectF(0, 0, 230, 600)); |
680 EXPECT_TRUE(drawable().mirror_vertical); | 680 EXPECT_TRUE(drawable().mirror_vertical); |
681 EXPECT_TRUE(drawable().mirror_horizontal); | 681 EXPECT_TRUE(drawable().mirror_horizontal); |
682 | 682 |
683 UpdateViewportRect(handle, kDefaultViewportRect); | 683 UpdateViewportRect(handle, kDefaultViewportRect); |
684 EXPECT_FALSE(drawable().mirror_vertical); | 684 EXPECT_FALSE(drawable().mirror_vertical); |
685 EXPECT_FALSE(drawable().mirror_horizontal); | 685 EXPECT_FALSE(drawable().mirror_horizontal); |
686 } | 686 } |
687 | 687 |
688 } // namespace ui | 688 } // namespace ui |
OLD | NEW |