| 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 "content/browser/renderer_host/input/touch_handle.h" | 5 #include "content/browser/renderer_host/input/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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } // namespace | 62 } // namespace |
| 63 | 63 |
| 64 class TouchHandleTest : public testing::Test, public TouchHandleClient { | 64 class TouchHandleTest : public testing::Test, public TouchHandleClient { |
| 65 public: | 65 public: |
| 66 TouchHandleTest() | 66 TouchHandleTest() |
| 67 : dragging_(false), | 67 : dragging_(false), |
| 68 dragged_(false), | 68 dragged_(false), |
| 69 tapped_(false), | 69 tapped_(false), |
| 70 needs_animate_(false) {} | 70 needs_animate_(false) {} |
| 71 | 71 |
| 72 virtual ~TouchHandleTest() {} | 72 ~TouchHandleTest() override {} |
| 73 | 73 |
| 74 // TouchHandleClient implementation. | 74 // TouchHandleClient implementation. |
| 75 void OnHandleDragBegin(const TouchHandle& handle) override { | 75 void OnHandleDragBegin(const TouchHandle& handle) override { |
| 76 dragging_ = true; | 76 dragging_ = true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void OnHandleDragUpdate(const TouchHandle& handle, | 79 void OnHandleDragUpdate(const TouchHandle& handle, |
| 80 const gfx::PointF& new_position) override { | 80 const gfx::PointF& new_position) override { |
| 81 dragged_ = true; | 81 dragged_ = true; |
| 82 drag_position_ = new_position; | 82 drag_position_ = new_position; |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 event = MockMotionEvent( | 482 event = MockMotionEvent( |
| 483 MockMotionEvent::ACTION_MOVE, event_time, kDefaultTapSlop * 2.f, 0); | 483 MockMotionEvent::ACTION_MOVE, event_time, kDefaultTapSlop * 2.f, 0); |
| 484 EXPECT_TRUE(handle.WillHandleTouchEvent(event)); | 484 EXPECT_TRUE(handle.WillHandleTouchEvent(event)); |
| 485 event = MockMotionEvent( | 485 event = MockMotionEvent( |
| 486 MockMotionEvent::ACTION_UP, event_time, kDefaultTapSlop * 2.f, 0); | 486 MockMotionEvent::ACTION_UP, event_time, kDefaultTapSlop * 2.f, 0); |
| 487 EXPECT_TRUE(handle.WillHandleTouchEvent(event)); | 487 EXPECT_TRUE(handle.WillHandleTouchEvent(event)); |
| 488 EXPECT_FALSE(GetAndResetHandleTapped()); | 488 EXPECT_FALSE(GetAndResetHandleTapped()); |
| 489 } | 489 } |
| 490 | 490 |
| 491 } // namespace content | 491 } // namespace content |
| OLD | NEW |