Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: ui/events/ozone/evdev/event_converter_evdev_impl_unittest.cc

Issue 742103002: Ozone keyboard layout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lite-code
Patch Set: reeeeebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/events/ozone/BUILD.gn ('k') | ui/events/ozone/evdev/event_factory_evdev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <linux/input.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/events/event.h" 12 #include "ui/events/event.h"
13 #include "ui/events/keycodes/keyboard_codes.h" 13 #include "ui/events/keycodes/keyboard_codes.h"
14 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" 14 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h"
15 #include "ui/events/ozone/evdev/event_converter_evdev_impl.h" 15 #include "ui/events/ozone/evdev/event_converter_evdev_impl.h"
16 #include "ui/events/ozone/evdev/keyboard_evdev.h" 16 #include "ui/events/ozone/evdev/keyboard_evdev.h"
17 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h" 17 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h"
18 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
18 19
19 namespace ui { 20 namespace ui {
20 21
21 const char kTestDevicePath[] = "/dev/input/test-device"; 22 const char kTestDevicePath[] = "/dev/input/test-device";
22 23
23 class MockEventConverterEvdevImpl : public EventConverterEvdevImpl { 24 class MockEventConverterEvdevImpl : public EventConverterEvdevImpl {
24 public: 25 public:
25 MockEventConverterEvdevImpl(int fd, 26 MockEventConverterEvdevImpl(int fd,
26 EventModifiersEvdev* modifiers, 27 EventModifiersEvdev* modifiers,
27 MouseButtonMapEvdev* button_map, 28 MouseButtonMapEvdev* button_map,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 events_out_ = evdev_io[1]; 94 events_out_ = evdev_io[1];
94 95
95 cursor_.reset(new ui::MockCursorEvdev()); 96 cursor_.reset(new ui::MockCursorEvdev());
96 modifiers_.reset(new ui::EventModifiersEvdev()); 97 modifiers_.reset(new ui::EventModifiersEvdev());
97 button_map_.reset(new ui::MouseButtonMapEvdev()); 98 button_map_.reset(new ui::MouseButtonMapEvdev());
98 99
99 const ui::EventDispatchCallback callback = 100 const ui::EventDispatchCallback callback =
100 base::Bind(&EventConverterEvdevImplTest::DispatchEventForTest, 101 base::Bind(&EventConverterEvdevImplTest::DispatchEventForTest,
101 base::Unretained(this)); 102 base::Unretained(this));
102 keyboard_.reset(new ui::KeyboardEvdev( 103 keyboard_.reset(new ui::KeyboardEvdev(
103 modifiers_.get(), callback)); 104 modifiers_.get(),
105 ui::KeyboardLayoutEngineManager::GetKeyboardLayoutEngine(), callback));
104 device_.reset(new ui::MockEventConverterEvdevImpl( 106 device_.reset(new ui::MockEventConverterEvdevImpl(
105 events_in_, modifiers_.get(), button_map_.get(), cursor_.get(), 107 events_in_, modifiers_.get(), button_map_.get(), cursor_.get(),
106 keyboard_.get(), callback)); 108 keyboard_.get(), callback));
107 } 109 }
108 void TearDown() override { 110 void TearDown() override {
109 device_.reset(); 111 device_.reset();
110 keyboard_.reset(); 112 keyboard_.reset();
111 modifiers_.reset(); 113 modifiers_.reset();
112 button_map_.reset(); 114 button_map_.reset();
113 cursor_.reset(); 115 cursor_.reset();
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 {{0, 0}, EV_KEY, BTN_TOUCH, 1}, 467 {{0, 0}, EV_KEY, BTN_TOUCH, 1},
466 {{0, 0}, EV_SYN, SYN_REPORT, 0}, 468 {{0, 0}, EV_SYN, SYN_REPORT, 0},
467 469
468 {{0, 0}, EV_KEY, BTN_TOUCH, 0}, 470 {{0, 0}, EV_KEY, BTN_TOUCH, 0},
469 {{0, 0}, EV_SYN, SYN_REPORT, 0}, 471 {{0, 0}, EV_SYN, SYN_REPORT, 0},
470 }; 472 };
471 473
472 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); 474 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue));
473 EXPECT_EQ(0u, size()); 475 EXPECT_EQ(0u, size());
474 } 476 }
OLDNEW
« no previous file with comments | « ui/events/ozone/BUILD.gn ('k') | ui/events/ozone/evdev/event_factory_evdev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698