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

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

Issue 270633012: Add native X11 testing to chromeos::EventRewriter unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check for supported keycode for final native test Created 6 years, 6 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/keycodes/keyboard_code_conversion_x.cc ('k') | no next file » | 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>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "ui/events/event_constants.h" 13 #include "ui/events/event_constants.h"
14 #include "ui/events/keycodes/keyboard_code_conversion_x.h" 14 #include "ui/events/keycodes/keyboard_code_conversion_x.h"
15 #include "ui/events/x/touch_factory_x11.h" 15 #include "ui/events/x/touch_factory_x11.h"
16 16
17 namespace { 17 namespace {
18 18
19 // Converts ui::EventType to state for X*Events. 19 // Converts ui::EventType to state for X*Events.
20 unsigned int XEventState(int flags) { 20 unsigned int XEventState(int flags) {
21 return 21 return
22 ((flags & ui::EF_SHIFT_DOWN) ? ShiftMask : 0) | 22 ((flags & ui::EF_SHIFT_DOWN) ? ShiftMask : 0) |
23 ((flags & ui::EF_CONTROL_DOWN) ? ControlMask : 0) | 23 ((flags & ui::EF_CONTROL_DOWN) ? ControlMask : 0) |
24 ((flags & ui::EF_ALT_DOWN) ? Mod1Mask : 0) | 24 ((flags & ui::EF_ALT_DOWN) ? Mod1Mask : 0) |
25 ((flags & ui::EF_CAPS_LOCK_DOWN) ? LockMask : 0) | 25 ((flags & ui::EF_CAPS_LOCK_DOWN) ? LockMask : 0) |
26 ((flags & ui::EF_ALTGR_DOWN) ? Mod5Mask : 0) |
27 ((flags & ui::EF_COMMAND_DOWN) ? Mod4Mask : 0) |
28 ((flags & ui::EF_MOD3_DOWN) ? Mod3Mask : 0) |
29 ((flags & ui::EF_NUMPAD_KEY) ? Mod2Mask : 0) |
26 ((flags & ui::EF_LEFT_MOUSE_BUTTON) ? Button1Mask: 0) | 30 ((flags & ui::EF_LEFT_MOUSE_BUTTON) ? Button1Mask: 0) |
27 ((flags & ui::EF_MIDDLE_MOUSE_BUTTON) ? Button2Mask: 0) | 31 ((flags & ui::EF_MIDDLE_MOUSE_BUTTON) ? Button2Mask: 0) |
28 ((flags & ui::EF_RIGHT_MOUSE_BUTTON) ? Button3Mask: 0); 32 ((flags & ui::EF_RIGHT_MOUSE_BUTTON) ? Button3Mask: 0);
29 } 33 }
30 34
31 // Converts EventType to XKeyEvent type. 35 // Converts EventType to XKeyEvent type.
32 int XKeyEventType(ui::EventType type) { 36 int XKeyEventType(ui::EventType type) {
33 switch (type) { 37 switch (type) {
34 case ui::ET_KEY_PRESSED: 38 case ui::ET_KEY_PRESSED:
35 return KeyPress; 39 return KeyPress;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 manager->SetDeviceListForTest(std::vector<unsigned int>(), device_list); 262 manager->SetDeviceListForTest(std::vector<unsigned int>(), device_list);
259 } 263 }
260 264
261 void SetUpTouchDevicesForTest(const std::vector<unsigned int>& devices) { 265 void SetUpTouchDevicesForTest(const std::vector<unsigned int>& devices) {
262 TouchFactory::GetInstance()->SetTouchDeviceForTest(devices); 266 TouchFactory::GetInstance()->SetTouchDeviceForTest(devices);
263 ui::DeviceDataManager* manager = ui::DeviceDataManager::GetInstance(); 267 ui::DeviceDataManager* manager = ui::DeviceDataManager::GetInstance();
264 manager->SetDeviceListForTest(devices, std::vector<unsigned int>()); 268 manager->SetDeviceListForTest(devices, std::vector<unsigned int>());
265 } 269 }
266 270
267 } // namespace ui 271 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/keycodes/keyboard_code_conversion_x.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698