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

Side by Side Diff: content/shell/renderer/test_runner/KeyCodeMapping.cpp

Issue 110533009: Import TestRunner library into chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/shell/renderer/test_runner/KeyCodeMapping.h"
6
7 #include "content/shell/renderer/test_runner/TestCommon.h"
8
9 namespace WebTestRunner {
10
11 int NativeKeyCodeForWindowsKeyCode(int keysym)
12 {
13 #if defined(__linux__) && defined(TOOLKIT_GTK)
14 // See /usr/share/X11/xkb/keycodes/*
15 static const int asciiToKeyCode[] = {
16 0,
17 0,
18 0,
19 0,
20 0,
21 0,
22 0,
23 0,
24 22,
25 23,
26 0,
27 0,
28 0,
29 36,
30 0,
31 0,
32 50,
33 37,
34 64,
35 127,
36 66,
37 0,
38 0,
39 0,
40 0,
41 131,
42 0,
43 9,
44 100,
45 102,
46 0,
47 0,
48 65, // ' '
49 112, // '!'
50 117, // '"'
51 115, // '#'
52 110, // '$'
53 113, // '%'
54 111, // '&'
55 114, // '''
56 116, // '('
57 0, // ')'
58 107, // '*'
59 0, // '+'
60 0, // ','
61 118, // '-'
62 119, // '.'
63 146, // '/'
64 19, // '0'
65 10, // '1'
66 11, // '2'
67 12, // '3'
68 13, // '4'
69 14, // '5'
70 15, // '6'
71 16, // '7'
72 17, // '8'
73 18, // '9'
74 0, // ':'
75 0, // ';'
76 0, // '<'
77 0, // '='
78 0, // '>'
79 0, // '?'
80 0, // '@'
81 38, // 'A'
82 56, // 'B'
83 54, // 'C'
84 40, // 'D'
85 26, // 'E'
86 41, // 'F'
87 42, // 'G'
88 43, // 'H'
89 31, // 'I'
90 44, // 'J'
91 45, // 'K'
92 46, // 'L'
93 58, // 'M'
94 57, // 'N'
95 32, // 'O'
96 33, // 'P'
97 24, // 'Q'
98 27, // 'R'
99 39, // 'S'
100 28, // 'T'
101 30, // 'U'
102 55, // 'V'
103 25, // 'W'
104 53, // 'X'
105 29, // 'Y'
106 52, // 'Z'
107 133, // '['
108 134, // '\'
109 135, // ']'
110 0, // '^'
111 0, // '_'
112 90, // '`'
113 38, // 'a'
114 56, // 'b'
115 54, // 'c'
116 40, // 'd'
117 26, // 'e'
118 41, // 'f'
119 42, // 'g'
120 43, // 'h'
121 31, // 'i'
122 44, // 'j'
123 45, // 'k'
124 46, // 'l'
125 58, // 'm'
126 57, // 'n'
127 32, // 'o'
128 33, // 'p'
129 24, // 'q'
130 27, // 'r'
131 39, // 's'
132 28, // 't'
133 30, // 'u'
134 55, // 'v'
135 25, // 'w'
136 53, // 'x'
137 29, // 'y'
138 52, // 'z'
139 96, // '{'
140 0, // '|'
141 0, // '}'
142 0, // '~'
143 0, // DEL
144 };
145
146 if (keysym <= 127)
147 return asciiToKeyCode[keysym];
148
149 switch (keysym) {
150 case VKEY_PRIOR:
151 return 112;
152 case VKEY_NEXT:
153 return 117;
154 case VKEY_END:
155 return 115;
156 case VKEY_HOME:
157 return 110;
158 case VKEY_LEFT:
159 return 113;
160 case VKEY_UP:
161 return 111;
162 case VKEY_RIGHT:
163 return 114;
164 case VKEY_DOWN:
165 return 116;
166 case VKEY_SNAPSHOT:
167 return 107;
168 case VKEY_INSERT:
169 return 118;
170 case VKEY_DELETE:
171 return 119;
172 case VKEY_APPS:
173 return 135;
174 case VKEY_F1:
175 case VKEY_F1 + 1:
176 case VKEY_F1 + 2:
177 case VKEY_F1 + 3:
178 case VKEY_F1 + 4:
179 case VKEY_F1 + 5:
180 case VKEY_F1 + 6:
181 case VKEY_F1 + 7:
182 case VKEY_F1 + 8:
183 case VKEY_F1 + 9:
184 case VKEY_F1 + 10:
185 case VKEY_F1 + 11:
186 case VKEY_F1 + 12:
187 case VKEY_F1 + 13:
188 case VKEY_F1 + 14:
189 case VKEY_F1 + 15:
190 case VKEY_F1 + 16:
191 case VKEY_F1 + 17:
192 case VKEY_F1 + 18:
193 case VKEY_F1 + 19:
194 case VKEY_F1 + 20:
195 case VKEY_F1 + 21:
196 case VKEY_F1 + 22:
197 case VKEY_F1 + 23:
198 return 67 + (keysym - VKEY_F1);
199 case VKEY_LSHIFT:
200 return 50;
201 case VKEY_RSHIFT:
202 return 62;
203 case VKEY_LCONTROL:
204 return 37;
205 case VKEY_RCONTROL:
206 return 105;
207 case VKEY_LMENU:
208 return 64;
209 case VKEY_RMENU:
210 return 108;
211 case VKEY_NUMLOCK:
212 return 77;
213
214 default:
215 return 0;
216 }
217 #else
218 return keysym - keysym;
219 #endif
220 }
221
222 }
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/KeyCodeMapping.h ('k') | content/shell/renderer/test_runner/MockColorChooser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698