| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/time/time.h" | 6 #include "base/time/time.h" |
| 7 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 7 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
| 8 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" | 8 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" |
| 9 #include "content/browser/renderer_host/input/synthetic_pointer_action.h" | 9 #include "content/browser/renderer_host/input/synthetic_pointer_action.h" |
| 10 #include "content/browser/renderer_host/input/synthetic_touch_driver.h" | 10 #include "content/browser/renderer_host/input/synthetic_touch_driver.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 WebInputEvent::Type type_; | 51 WebInputEvent::Type type_; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 class MockSyntheticPointerTouchActionTarget | 54 class MockSyntheticPointerTouchActionTarget |
| 55 : public MockSyntheticPointerActionTarget { | 55 : public MockSyntheticPointerActionTarget { |
| 56 public: | 56 public: |
| 57 MockSyntheticPointerTouchActionTarget() {} | 57 MockSyntheticPointerTouchActionTarget() {} |
| 58 ~MockSyntheticPointerTouchActionTarget() override {} | 58 ~MockSyntheticPointerTouchActionTarget() override {} |
| 59 | 59 |
| 60 void DispatchInputEventToPlatform(const WebInputEvent& event) override { | 60 void DispatchInputEventToPlatform(const WebInputEvent& event) override { |
| 61 ASSERT_TRUE(WebInputEvent::isTouchEventType(event.type)); | 61 ASSERT_TRUE(WebInputEvent::isTouchEventType(event.type())); |
| 62 const WebTouchEvent& touch_event = static_cast<const WebTouchEvent&>(event); | 62 const WebTouchEvent& touch_event = static_cast<const WebTouchEvent&>(event); |
| 63 type_ = touch_event.type; | 63 type_ = touch_event.type(); |
| 64 for (size_t i = 0; i < touch_event.touchesLength; ++i) { | 64 for (size_t i = 0; i < touch_event.touchesLength; ++i) { |
| 65 indexes_[i] = touch_event.touches[i].id; | 65 indexes_[i] = touch_event.touches[i].id; |
| 66 positions_[i] = gfx::PointF(touch_event.touches[i].position); | 66 positions_[i] = gfx::PointF(touch_event.touches[i].position); |
| 67 states_[i] = touch_event.touches[i].state; | 67 states_[i] = touch_event.touches[i].state; |
| 68 } | 68 } |
| 69 touch_length_ = touch_event.touchesLength; | 69 touch_length_ = touch_event.touchesLength; |
| 70 } | 70 } |
| 71 | 71 |
| 72 SyntheticGestureParams::GestureSourceType | 72 SyntheticGestureParams::GestureSourceType |
| 73 GetDefaultSyntheticGestureSourceType() const override { | 73 GetDefaultSyntheticGestureSourceType() const override { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 86 WebTouchPoint::State states_[WebTouchEvent::kTouchesLengthCap]; | 86 WebTouchPoint::State states_[WebTouchEvent::kTouchesLengthCap]; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 class MockSyntheticPointerMouseActionTarget | 89 class MockSyntheticPointerMouseActionTarget |
| 90 : public MockSyntheticPointerActionTarget { | 90 : public MockSyntheticPointerActionTarget { |
| 91 public: | 91 public: |
| 92 MockSyntheticPointerMouseActionTarget() {} | 92 MockSyntheticPointerMouseActionTarget() {} |
| 93 ~MockSyntheticPointerMouseActionTarget() override {} | 93 ~MockSyntheticPointerMouseActionTarget() override {} |
| 94 | 94 |
| 95 void DispatchInputEventToPlatform(const WebInputEvent& event) override { | 95 void DispatchInputEventToPlatform(const WebInputEvent& event) override { |
| 96 ASSERT_TRUE(WebInputEvent::isMouseEventType(event.type)); | 96 ASSERT_TRUE(WebInputEvent::isMouseEventType(event.type())); |
| 97 const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); | 97 const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); |
| 98 type_ = mouse_event.type; | 98 type_ = mouse_event.type(); |
| 99 position_ = gfx::PointF(mouse_event.x, mouse_event.y); | 99 position_ = gfx::PointF(mouse_event.x, mouse_event.y); |
| 100 clickCount_ = mouse_event.clickCount; | 100 clickCount_ = mouse_event.clickCount; |
| 101 button_ = mouse_event.button; | 101 button_ = mouse_event.button; |
| 102 } | 102 } |
| 103 | 103 |
| 104 SyntheticGestureParams::GestureSourceType | 104 SyntheticGestureParams::GestureSourceType |
| 105 GetDefaultSyntheticGestureSourceType() const override { | 105 GetDefaultSyntheticGestureSourceType() const override { |
| 106 return SyntheticGestureParams::MOUSE_INPUT; | 106 return SyntheticGestureParams::MOUSE_INPUT; |
| 107 } | 107 } |
| 108 | 108 |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 action_param_list_->at(0).set_pointer_action_type( | 517 action_param_list_->at(0).set_pointer_action_type( |
| 518 SyntheticPointerActionParams::PointerActionType::PRESS); | 518 SyntheticPointerActionParams::PointerActionType::PRESS); |
| 519 ForwardSyntheticPointerAction(); | 519 ForwardSyntheticPointerAction(); |
| 520 | 520 |
| 521 EXPECT_EQ(2, num_success_); | 521 EXPECT_EQ(2, num_success_); |
| 522 EXPECT_EQ(2, num_failure_); | 522 EXPECT_EQ(2, num_failure_); |
| 523 } | 523 } |
| 524 | 524 |
| 525 } // namespace | 525 } // namespace |
| 526 | 526 |
| 527 } // namespace content | 527 } // namespace content |
| OLD | NEW |