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 #include "ui/touch_selection/touch_handle_orientation.h" | 10 #include "ui/touch_selection/touch_handle_orientation.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 public: | 67 public: |
68 TouchHandleTest() | 68 TouchHandleTest() |
69 : dragging_(false), | 69 : dragging_(false), |
70 dragged_(false), | 70 dragged_(false), |
71 tapped_(false), | 71 tapped_(false), |
72 needs_animate_(false) {} | 72 needs_animate_(false) {} |
73 | 73 |
74 ~TouchHandleTest() override {} | 74 ~TouchHandleTest() override {} |
75 | 75 |
76 // TouchHandleClient implementation. | 76 // TouchHandleClient implementation. |
77 void OnHandleDragBegin(const TouchHandle& handle) override { | 77 void OnDragBegin(const TouchSelectionDraggable& handler, |
| 78 const gfx::PointF& drag_position) override { |
78 dragging_ = true; | 79 dragging_ = true; |
79 } | 80 } |
80 | 81 |
81 void OnHandleDragUpdate(const TouchHandle& handle, | 82 void OnDragUpdate(const TouchSelectionDraggable& handler, |
82 const gfx::PointF& new_position) override { | 83 const gfx::PointF& drag_position) override { |
83 dragged_ = true; | 84 dragged_ = true; |
84 drag_position_ = new_position; | 85 drag_position_ = drag_position; |
85 } | 86 } |
86 | 87 |
87 void OnHandleDragEnd(const TouchHandle& handle) override { | 88 void OnDragEnd(const TouchSelectionDraggable& handler) override { |
88 dragging_ = false; | 89 dragging_ = false; |
89 } | 90 } |
90 | 91 |
91 void OnHandleTapped(const TouchHandle& handle) override { tapped_ = true; } | 92 void OnHandleTapped(const TouchHandle& handle) override { tapped_ = true; } |
92 | 93 |
93 void SetNeedsAnimate() override { needs_animate_ = true; } | 94 void SetNeedsAnimate() override { needs_animate_ = true; } |
94 | 95 |
95 scoped_ptr<TouchHandleDrawable> CreateDrawable() override { | 96 scoped_ptr<TouchHandleDrawable> CreateDrawable() override { |
96 return make_scoped_ptr(new MockTouchHandleDrawable(&drawable_data_)); | 97 return make_scoped_ptr(new MockTouchHandleDrawable(&drawable_data_)); |
97 } | 98 } |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 event = MockMotionEvent( | 499 event = MockMotionEvent( |
499 MockMotionEvent::ACTION_MOVE, event_time, kDefaultTapSlop * 2.f, 0); | 500 MockMotionEvent::ACTION_MOVE, event_time, kDefaultTapSlop * 2.f, 0); |
500 EXPECT_TRUE(handle.WillHandleTouchEvent(event)); | 501 EXPECT_TRUE(handle.WillHandleTouchEvent(event)); |
501 event = MockMotionEvent( | 502 event = MockMotionEvent( |
502 MockMotionEvent::ACTION_UP, event_time, kDefaultTapSlop * 2.f, 0); | 503 MockMotionEvent::ACTION_UP, event_time, kDefaultTapSlop * 2.f, 0); |
503 EXPECT_TRUE(handle.WillHandleTouchEvent(event)); | 504 EXPECT_TRUE(handle.WillHandleTouchEvent(event)); |
504 EXPECT_FALSE(GetAndResetHandleTapped()); | 505 EXPECT_FALSE(GetAndResetHandleTapped()); |
505 } | 506 } |
506 | 507 |
507 } // namespace ui | 508 } // namespace ui |
OLD | NEW |