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 "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "ui/events/test/motion_event_test_utils.h" | 8 #include "ui/events/test/motion_event_test_utils.h" |
9 #include "ui/gfx/geometry/rect_f.h" | 9 #include "ui/gfx/geometry/rect_f.h" |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 void OnHandleDragEnd(const TouchHandle& handle) override { | 86 void OnHandleDragEnd(const TouchHandle& handle) override { |
87 dragging_ = false; | 87 dragging_ = false; |
88 } | 88 } |
89 | 89 |
90 void OnHandleTapped(const TouchHandle& handle) override { tapped_ = true; } | 90 void OnHandleTapped(const TouchHandle& handle) override { tapped_ = true; } |
91 | 91 |
92 void SetNeedsAnimate() override { needs_animate_ = true; } | 92 void SetNeedsAnimate() override { needs_animate_ = true; } |
93 | 93 |
94 scoped_ptr<TouchHandleDrawable> CreateDrawable() override { | 94 scoped_ptr<TouchHandleDrawable> CreateDrawable() override { |
95 return scoped_ptr<TouchHandleDrawable>( | 95 return make_scoped_ptr(new MockTouchHandleDrawable(&drawable_data_)); |
96 new MockTouchHandleDrawable(&drawable_data_)); | |
97 } | 96 } |
98 | 97 |
99 base::TimeDelta GetTapTimeout() const override { | 98 base::TimeDelta GetTapTimeout() const override { |
100 return base::TimeDelta::FromMilliseconds(kDefaultTapTimeoutMs); | 99 return base::TimeDelta::FromMilliseconds(kDefaultTapTimeoutMs); |
101 } | 100 } |
102 | 101 |
103 float GetTapSlop() const override { return kDefaultTapSlop; } | 102 float GetTapSlop() const override { return kDefaultTapSlop; } |
104 | 103 |
105 void Animate(TouchHandle& handle) { | 104 void Animate(TouchHandle& handle) { |
106 needs_animate_ = false; | 105 needs_animate_ = false; |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 event = MockMotionEvent( | 497 event = MockMotionEvent( |
499 MockMotionEvent::ACTION_MOVE, event_time, kDefaultTapSlop * 2.f, 0); | 498 MockMotionEvent::ACTION_MOVE, event_time, kDefaultTapSlop * 2.f, 0); |
500 EXPECT_TRUE(handle.WillHandleTouchEvent(event)); | 499 EXPECT_TRUE(handle.WillHandleTouchEvent(event)); |
501 event = MockMotionEvent( | 500 event = MockMotionEvent( |
502 MockMotionEvent::ACTION_UP, event_time, kDefaultTapSlop * 2.f, 0); | 501 MockMotionEvent::ACTION_UP, event_time, kDefaultTapSlop * 2.f, 0); |
503 EXPECT_TRUE(handle.WillHandleTouchEvent(event)); | 502 EXPECT_TRUE(handle.WillHandleTouchEvent(event)); |
504 EXPECT_FALSE(GetAndResetHandleTapped()); | 503 EXPECT_FALSE(GetAndResetHandleTapped()); |
505 } | 504 } |
506 | 505 |
507 } // namespace ui | 506 } // namespace ui |
OLD | NEW |