Index: ui/events/ozone/evdev/event_converter_evdev_impl_unittest.cc |
diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl_unittest.cc b/ui/events/ozone/evdev/event_converter_evdev_impl_unittest.cc |
index d5ed5891aa4834946cd4568c93aeea3476fa6091..1b956885fc18ff7d8e7a60d7ec8873a0508964a6 100644 |
--- a/ui/events/ozone/evdev/event_converter_evdev_impl_unittest.cc |
+++ b/ui/events/ozone/evdev/event_converter_evdev_impl_unittest.cc |
@@ -398,6 +398,70 @@ TEST_F(EventConverterEvdevImplTest, MouseButton) { |
EXPECT_EQ(true, event->IsLeftMouseButton()); |
} |
+// Test that BTN_BACK and BTN_SIDE are treated as the same button. |
+TEST_F(EventConverterEvdevImplTest, MouseBackButton) { |
+ ui::MockEventConverterEvdevImpl* dev = device(); |
+ |
+ struct input_event mock_kernel_queue[] = { |
+ {{0, 0}, EV_KEY, BTN_SIDE, 1}, |
+ {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
+ |
+ {{0, 0}, EV_KEY, BTN_BACK, 1}, |
+ {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
+ |
+ {{0, 0}, EV_KEY, BTN_SIDE, 0}, |
+ {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
+ |
+ {{0, 0}, EV_KEY, BTN_BACK, 0}, |
+ {{0, 0}, EV_SYN, SYN_REPORT, 0} |
+ }; |
+ |
+ dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); |
+ EXPECT_EQ(2u, size()); |
+ |
+ ui::MouseEvent* event = nullptr; |
+ |
+ event = dispatched_mouse_event(0); |
+ EXPECT_EQ(ui::ET_MOUSE_PRESSED, event->type()); |
+ EXPECT_EQ(ui::EF_BACK_MOUSE_BUTTON, event->changed_button_flags()); |
+ |
+ event = dispatched_mouse_event(1); |
+ EXPECT_EQ(ui::ET_MOUSE_RELEASED, event->type()); |
+ EXPECT_EQ(ui::EF_BACK_MOUSE_BUTTON, event->changed_button_flags()); |
+} |
+ |
+// Test that BTN_FORWARD and BTN_EXTRA are treated as the same button. |
+TEST_F(EventConverterEvdevImplTest, MouseForwardButton) { |
+ ui::MockEventConverterEvdevImpl* dev = device(); |
+ |
+ struct input_event mock_kernel_queue[] = { |
+ {{0, 0}, EV_KEY, BTN_FORWARD, 1}, |
+ {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
+ |
+ {{0, 0}, EV_KEY, BTN_EXTRA, 1}, |
+ {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
+ |
+ {{0, 0}, EV_KEY, BTN_EXTRA, 0}, |
+ {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
+ |
+ {{0, 0}, EV_KEY, BTN_FORWARD, 0}, |
+ {{0, 0}, EV_SYN, SYN_REPORT, 0} |
+ }; |
+ |
+ dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); |
+ EXPECT_EQ(2u, size()); |
+ |
+ ui::MouseEvent* event = nullptr; |
+ |
+ event = dispatched_mouse_event(0); |
+ EXPECT_EQ(ui::ET_MOUSE_PRESSED, event->type()); |
+ EXPECT_EQ(ui::EF_FORWARD_MOUSE_BUTTON, event->changed_button_flags()); |
+ |
+ event = dispatched_mouse_event(1); |
+ EXPECT_EQ(ui::ET_MOUSE_RELEASED, event->type()); |
+ EXPECT_EQ(ui::EF_FORWARD_MOUSE_BUTTON, event->changed_button_flags()); |
+} |
+ |
TEST_F(EventConverterEvdevImplTest, MouseMove) { |
ui::MockEventConverterEvdevImpl* dev = device(); |