| 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/events/ozone/evdev/touch_event_converter_evdev.h" | 5 #include "ui/events/ozone/evdev/touch_event_converter_evdev.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <linux/input.h> | 8 #include <linux/input.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 class MockDeviceEventDispatcherEvdev : public DeviceEventDispatcherEvdev { | 114 class MockDeviceEventDispatcherEvdev : public DeviceEventDispatcherEvdev { |
| 115 public: | 115 public: |
| 116 MockDeviceEventDispatcherEvdev( | 116 MockDeviceEventDispatcherEvdev( |
| 117 const base::Callback<void(const GenericEventParams& params)>& callback) | 117 const base::Callback<void(const GenericEventParams& params)>& callback) |
| 118 : callback_(callback) {} | 118 : callback_(callback) {} |
| 119 ~MockDeviceEventDispatcherEvdev() override {} | 119 ~MockDeviceEventDispatcherEvdev() override {} |
| 120 | 120 |
| 121 // DeviceEventDispatcherEvdev: | 121 // DeviceEventDispatcherEvdev: |
| 122 void DispatchGamepadEvent(const GamepadEventParams& params) override {} |
| 122 void DispatchKeyEvent(const KeyEventParams& params) override {} | 123 void DispatchKeyEvent(const KeyEventParams& params) override {} |
| 123 void DispatchMouseMoveEvent(const MouseMoveEventParams& params) override { | 124 void DispatchMouseMoveEvent(const MouseMoveEventParams& params) override { |
| 124 GenericEventParams generic; | 125 GenericEventParams generic; |
| 125 generic.type = GenericEventParamsType::MOUSE_MOVE; | 126 generic.type = GenericEventParamsType::MOUSE_MOVE; |
| 126 generic.mouse_move = params; | 127 generic.mouse_move = params; |
| 127 callback_.Run(generic); | 128 callback_.Run(generic); |
| 128 } | 129 } |
| 129 void DispatchMouseButtonEvent(const MouseButtonEventParams& params) override { | 130 void DispatchMouseButtonEvent(const MouseButtonEventParams& params) override { |
| 130 GenericEventParams generic; | 131 GenericEventParams generic; |
| 131 generic.type = GenericEventParamsType::MOUSE_BUTTON; | 132 generic.type = GenericEventParamsType::MOUSE_BUTTON; |
| 132 generic.mouse_button = params; | 133 generic.mouse_button = params; |
| 133 callback_.Run(generic); | 134 callback_.Run(generic); |
| 134 } | 135 } |
| 135 void DispatchMouseWheelEvent(const MouseWheelEventParams& params) override {} | 136 void DispatchMouseWheelEvent(const MouseWheelEventParams& params) override {} |
| 136 void DispatchPinchEvent(const PinchEventParams& params) override {} | 137 void DispatchPinchEvent(const PinchEventParams& params) override {} |
| 137 void DispatchScrollEvent(const ScrollEventParams& params) override {} | 138 void DispatchScrollEvent(const ScrollEventParams& params) override {} |
| 138 void DispatchTouchEvent(const TouchEventParams& params) override { | 139 void DispatchTouchEvent(const TouchEventParams& params) override { |
| 139 GenericEventParams generic; | 140 GenericEventParams generic; |
| 140 generic.type = GenericEventParamsType::TOUCH; | 141 generic.type = GenericEventParamsType::TOUCH; |
| 141 generic.touch = params; | 142 generic.touch = params; |
| 142 callback_.Run(generic); | 143 callback_.Run(generic); |
| 143 } | 144 } |
| 144 | 145 |
| 146 void DispatchGamepadDevicesUpdated( |
| 147 const std::vector<InputDevice>& devices) override {} |
| 145 void DispatchKeyboardDevicesUpdated( | 148 void DispatchKeyboardDevicesUpdated( |
| 146 const std::vector<InputDevice>& devices) override {} | 149 const std::vector<InputDevice>& devices) override {} |
| 147 void DispatchTouchscreenDevicesUpdated( | 150 void DispatchTouchscreenDevicesUpdated( |
| 148 const std::vector<TouchscreenDevice>& devices) override {} | 151 const std::vector<TouchscreenDevice>& devices) override {} |
| 149 void DispatchMouseDevicesUpdated( | 152 void DispatchMouseDevicesUpdated( |
| 150 const std::vector<InputDevice>& devices) override {} | 153 const std::vector<InputDevice>& devices) override {} |
| 151 void DispatchTouchpadDevicesUpdated( | 154 void DispatchTouchpadDevicesUpdated( |
| 152 const std::vector<InputDevice>& devices) override {} | 155 const std::vector<InputDevice>& devices) override {} |
| 153 void DispatchDeviceListsComplete() override {} | 156 void DispatchDeviceListsComplete() override {} |
| 154 void DispatchStylusStateChanged(StylusState stylus_state) override {} | 157 void DispatchStylusStateChanged(StylusState stylus_state) override {} |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 event = dispatched_touch_event(3); | 1106 event = dispatched_touch_event(3); |
| 1104 EXPECT_EQ(ET_TOUCH_RELEASED, event.type); | 1107 EXPECT_EQ(ET_TOUCH_RELEASED, event.type); |
| 1105 EXPECT_EQ(8930, event.location.x()); | 1108 EXPECT_EQ(8930, event.location.x()); |
| 1106 EXPECT_EQ(980, event.location.y()); | 1109 EXPECT_EQ(980, event.location.y()); |
| 1107 EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN, | 1110 EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN, |
| 1108 event.pointer_details.pointer_type); | 1111 event.pointer_details.pointer_type); |
| 1109 EXPECT_EQ(0.f / 1024, event.pointer_details.force); | 1112 EXPECT_EQ(0.f / 1024, event.pointer_details.force); |
| 1110 } | 1113 } |
| 1111 | 1114 |
| 1112 } // namespace ui | 1115 } // namespace ui |
| OLD | NEW |