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

Side by Side Diff: ui/events/test/events_test_utils_x11.cc

Issue 538143002: Fix test for master device. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Identify virtual core keyboard. Created 6 years, 3 months 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/test/events_test_utils_x11.h ('k') | ui/events/x/events_x_unittest.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/test/events_test_utils_x11.h" 5 #include "ui/events/test/events_test_utils_x11.h"
6 6
7 #include <X11/extensions/XI2.h> 7 #include <X11/extensions/XI2.h>
8 #include <X11/keysym.h> 8 #include <X11/keysym.h>
9 #include <X11/X.h> 9 #include <X11/X.h>
10 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 event_->xkey.x = 0; 164 event_->xkey.x = 0;
165 event_->xkey.y = 0; 165 event_->xkey.y = 0;
166 event_->xkey.x_root = 0; 166 event_->xkey.x_root = 0;
167 event_->xkey.y_root = 0; 167 event_->xkey.y_root = 0;
168 event_->xkey.state = XEventState(flags); 168 event_->xkey.state = XEventState(flags);
169 event_->xkey.keycode = XKeyCodeForWindowsKeyCode(key_code, flags, display); 169 event_->xkey.keycode = XKeyCodeForWindowsKeyCode(key_code, flags, display);
170 event_->xkey.same_screen = 1; 170 event_->xkey.same_screen = 1;
171 } 171 }
172 172
173 void ScopedXI2Event::InitGenericKeyEvent(int deviceid, 173 void ScopedXI2Event::InitGenericKeyEvent(int deviceid,
174 int sourceid,
174 EventType type, 175 EventType type,
175 KeyboardCode key_code, 176 KeyboardCode key_code,
176 int flags) { 177 int flags) {
177 event_.reset( 178 event_.reset(
178 CreateXInput2Event(deviceid, XIKeyEventType(type), 0, gfx::Point())); 179 CreateXInput2Event(deviceid, XIKeyEventType(type), 0, gfx::Point()));
179 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(event_->xcookie.data); 180 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(event_->xcookie.data);
180 CHECK_NE(0, xievent->evtype); 181 CHECK_NE(0, xievent->evtype);
181 XDisplay* display = gfx::GetXDisplay(); 182 XDisplay* display = gfx::GetXDisplay();
182 event_->xgeneric.display = display; 183 event_->xgeneric.display = display;
183 xievent->display = display; 184 xievent->display = display;
184 xievent->mods.effective = XEventState(flags); 185 xievent->mods.effective = XEventState(flags);
185 xievent->detail = XKeyCodeForWindowsKeyCode(key_code, flags, display); 186 xievent->detail = XKeyCodeForWindowsKeyCode(key_code, flags, display);
187 xievent->sourceid = sourceid;
186 } 188 }
187 189
188 void ScopedXI2Event::InitGenericButtonEvent(int deviceid, 190 void ScopedXI2Event::InitGenericButtonEvent(int deviceid,
189 EventType type, 191 EventType type,
190 const gfx::Point& location, 192 const gfx::Point& location,
191 int flags) { 193 int flags) {
192 event_.reset(CreateXInput2Event(deviceid, 194 event_.reset(CreateXInput2Event(deviceid,
193 XIButtonEventType(type), 0, gfx::Point())); 195 XIButtonEventType(type), 0, gfx::Point()));
194 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(event_->xcookie.data); 196 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(event_->xcookie.data);
195 xievent->mods.effective = XEventState(flags); 197 xievent->mods.effective = XEventState(flags);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 manager->SetDeviceListForTest(std::vector<unsigned int>(), device_list); 295 manager->SetDeviceListForTest(std::vector<unsigned int>(), device_list);
294 } 296 }
295 297
296 void SetUpTouchDevicesForTest(const std::vector<unsigned int>& devices) { 298 void SetUpTouchDevicesForTest(const std::vector<unsigned int>& devices) {
297 TouchFactory::GetInstance()->SetTouchDeviceForTest(devices); 299 TouchFactory::GetInstance()->SetTouchDeviceForTest(devices);
298 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); 300 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance();
299 manager->SetDeviceListForTest(devices, std::vector<unsigned int>()); 301 manager->SetDeviceListForTest(devices, std::vector<unsigned int>());
300 } 302 }
301 303
302 } // namespace ui 304 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/test/events_test_utils_x11.h ('k') | ui/events/x/events_x_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698