| 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 "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 class MockSyntheticPointerMouseActionTarget | 170 class MockSyntheticPointerMouseActionTarget |
| 171 : public MockSyntheticPointerActionTarget { | 171 : public MockSyntheticPointerActionTarget { |
| 172 public: | 172 public: |
| 173 MockSyntheticPointerMouseActionTarget() : click_count_(0), modifiers_(0) {} | 173 MockSyntheticPointerMouseActionTarget() : click_count_(0), modifiers_(0) {} |
| 174 ~MockSyntheticPointerMouseActionTarget() override {} | 174 ~MockSyntheticPointerMouseActionTarget() override {} |
| 175 | 175 |
| 176 void DispatchInputEventToPlatform(const WebInputEvent& event) override { | 176 void DispatchInputEventToPlatform(const WebInputEvent& event) override { |
| 177 DCHECK(WebInputEvent::isMouseEventType(event.type())); | 177 DCHECK(WebInputEvent::isMouseEventType(event.type())); |
| 178 const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); | 178 const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); |
| 179 type_ = mouse_event.type(); | 179 type_ = mouse_event.type(); |
| 180 position_ = gfx::PointF(mouse_event.x, mouse_event.y); | 180 position_ = gfx::PointF(mouse_event.positionInWidget()); |
| 181 click_count_ = mouse_event.clickCount; | 181 click_count_ = mouse_event.clickCount; |
| 182 modifiers_ = mouse_event.modifiers(); | 182 modifiers_ = mouse_event.modifiers(); |
| 183 button_ = mouse_event.button; | 183 button_ = mouse_event.button; |
| 184 } | 184 } |
| 185 | 185 |
| 186 testing::AssertionResult SyntheticMouseActionDispatchedCorrectly( | 186 testing::AssertionResult SyntheticMouseActionDispatchedCorrectly( |
| 187 const SyntheticPointerActionParams& param, | 187 const SyntheticPointerActionParams& param, |
| 188 int click_count, | 188 int click_count, |
| 189 std::vector<SyntheticPointerActionParams::Button> buttons, | 189 std::vector<SyntheticPointerActionParams::Button> buttons, |
| 190 SyntheticGestureParams::GestureSourceType source_type = | 190 SyntheticGestureParams::GestureSourceType source_type = |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 ForwardSyntheticPointerAction(); | 703 ForwardSyntheticPointerAction(); |
| 704 EXPECT_EQ(3, num_success_); | 704 EXPECT_EQ(3, num_success_); |
| 705 EXPECT_EQ(0, num_failure_); | 705 EXPECT_EQ(0, num_failure_); |
| 706 EXPECT_TRUE(pointer_pen_target->SyntheticMouseActionDispatchedCorrectly( | 706 EXPECT_TRUE(pointer_pen_target->SyntheticMouseActionDispatchedCorrectly( |
| 707 param3, 1, buttons, SyntheticGestureParams::PEN_INPUT)); | 707 param3, 1, buttons, SyntheticGestureParams::PEN_INPUT)); |
| 708 } | 708 } |
| 709 | 709 |
| 710 } // namespace | 710 } // namespace |
| 711 | 711 |
| 712 } // namespace content | 712 } // namespace content |
| OLD | NEW |