| 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/input_injector_evdev.h" | 5 #include "ui/events/ozone/evdev/input_injector_evdev.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "ui/events/ozone/device/device_manager.h" | 11 #include "ui/events/ozone/device/device_manager.h" |
| 12 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 12 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
| 13 #include "ui/events/ozone/evdev/event_converter_test_util.h" | 13 #include "ui/events/ozone/evdev/event_converter_test_util.h" |
| 14 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 14 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
| 15 #include "ui/events/ozone/events_ozone.h" | 15 #include "ui/events/ozone/events_ozone.h" |
| 16 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" | 16 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" |
| 17 | 17 |
| 18 namespace ui { | 18 namespace ui { |
| 19 | 19 |
| 20 using testing::AllOf; | 20 using testing::AllOf; |
| 21 using testing::InSequence; | 21 using testing::InSequence; |
| 22 using testing::Property; | 22 using testing::Property; |
| 23 | 23 |
| 24 class EventObserver { | 24 class EventObserver { |
| 25 public: | 25 public: |
| 26 void EventDispatchCallback(scoped_ptr<Event> event) { | 26 void EventDispatchCallback(Event* event) { |
| 27 DispatchEventFromNativeUiEvent( | 27 DispatchEventFromNativeUiEvent( |
| 28 event.get(), | 28 event, base::Bind(&EventObserver::OnEvent, base::Unretained(this))); |
| 29 base::Bind(&EventObserver::OnEvent, base::Unretained(this))); | |
| 30 } | 29 } |
| 31 | 30 |
| 32 void OnEvent(Event* event) { | 31 void OnEvent(Event* event) { |
| 33 if (event->IsMouseEvent()) { | 32 if (event->IsMouseEvent()) { |
| 34 if (event->type() == ET_MOUSEWHEEL) { | 33 if (event->type() == ET_MOUSEWHEEL) { |
| 35 OnMouseWheelEvent(static_cast<MouseWheelEvent*>(event)); | 34 OnMouseWheelEvent(static_cast<MouseWheelEvent*>(event)); |
| 36 } else { | 35 } else { |
| 37 OnMouseEvent(static_cast<MouseEvent*>(event)); | 36 OnMouseEvent(static_cast<MouseEvent*>(event)); |
| 38 } | 37 } |
| 39 } | 38 } |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 MatchesMouseEvent(ET_MOUSEWHEEL, 0, 10, 20), | 215 MatchesMouseEvent(ET_MOUSEWHEEL, 0, 10, 20), |
| 217 Property(&MouseWheelEvent::x_offset, 100), | 216 Property(&MouseWheelEvent::x_offset, 100), |
| 218 Property(&MouseWheelEvent::y_offset, 0)))); | 217 Property(&MouseWheelEvent::y_offset, 0)))); |
| 219 injector_.MoveCursorTo(gfx::PointF(10, 20)); | 218 injector_.MoveCursorTo(gfx::PointF(10, 20)); |
| 220 injector_.InjectMouseWheel(0, 100); | 219 injector_.InjectMouseWheel(0, 100); |
| 221 injector_.InjectMouseWheel(100, 0); | 220 injector_.InjectMouseWheel(100, 0); |
| 222 run_loop_.RunUntilIdle(); | 221 run_loop_.RunUntilIdle(); |
| 223 } | 222 } |
| 224 | 223 |
| 225 } // namespace ui | 224 } // namespace ui |
| OLD | NEW |