| 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 <linux/input.h> |
| 5 #include <utility> | 6 #include <utility> |
| 6 | 7 |
| 7 #include "base/bind.h" | 8 #include "base/bind.h" |
| 8 #include "base/macros.h" | 9 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
| 11 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "ui/events/event.h" | 14 #include "ui/events/event.h" |
| 14 #include "ui/events/keycodes/dom/dom_code.h" | 15 #include "ui/events/keycodes/dom/dom_code.h" |
| 15 #include "ui/events/keycodes/keyboard_codes.h" | 16 #include "ui/events/keycodes/keyboard_codes.h" |
| 16 #include "ui/events/ozone/device/device_manager.h" | 17 #include "ui/events/ozone/device/device_manager.h" |
| 17 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 18 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
| 18 // Note: This should normally be the first include in the list, but it | |
| 19 // transitively includes <linux/input.h>, which breaks dom_code.h due to macros | |
| 20 // that conflict with enumerator names. | |
| 21 #include "ui/events/ozone/evdev/event_converter_evdev_impl.h" | 19 #include "ui/events/ozone/evdev/event_converter_evdev_impl.h" |
| 22 #include "ui/events/ozone/evdev/event_converter_test_util.h" | 20 #include "ui/events/ozone/evdev/event_converter_test_util.h" |
| 23 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 21 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
| 24 #include "ui/events/ozone/evdev/keyboard_evdev.h" | 22 #include "ui/events/ozone/evdev/keyboard_evdev.h" |
| 25 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" | 23 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" |
| 26 | 24 |
| 27 // This is not ordered with the normal #includes, due to the aforementioned | |
| 28 // macro conflict. | |
| 29 #include <linux/input.h> | |
| 30 | |
| 31 namespace ui { | 25 namespace ui { |
| 32 | 26 |
| 33 const char kTestDevicePath[] = "/dev/input/test-device"; | 27 const char kTestDevicePath[] = "/dev/input/test-device"; |
| 34 | 28 |
| 35 class MockEventConverterEvdevImpl : public EventConverterEvdevImpl { | 29 class MockEventConverterEvdevImpl : public EventConverterEvdevImpl { |
| 36 public: | 30 public: |
| 37 MockEventConverterEvdevImpl(int fd, | 31 MockEventConverterEvdevImpl(int fd, |
| 38 CursorDelegateEvdev* cursor, | 32 CursorDelegateEvdev* cursor, |
| 39 DeviceEventDispatcherEvdev* dispatcher) | 33 DeviceEventDispatcherEvdev* dispatcher) |
| 40 : EventConverterEvdevImpl(fd, | 34 : EventConverterEvdevImpl(fd, |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 dev->SetKeyFilter(true /* enable_filter */, allowed_keys); | 657 dev->SetKeyFilter(true /* enable_filter */, allowed_keys); |
| 664 ASSERT_EQ(1u, size()); | 658 ASSERT_EQ(1u, size()); |
| 665 event = dispatched_event(0); | 659 event = dispatched_event(0); |
| 666 EXPECT_EQ(ui::ET_KEY_RELEASED, event->type()); | 660 EXPECT_EQ(ui::ET_KEY_RELEASED, event->type()); |
| 667 | 661 |
| 668 // The real key release should be dropped, whenever it comes. | 662 // The real key release should be dropped, whenever it comes. |
| 669 ClearDispatchedEvents(); | 663 ClearDispatchedEvents(); |
| 670 dev->ProcessEvents(key_release, arraysize(key_release)); | 664 dev->ProcessEvents(key_release, arraysize(key_release)); |
| 671 ASSERT_EQ(0u, size()); | 665 ASSERT_EQ(0u, size()); |
| 672 } | 666 } |
| OLD | NEW |