OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 ui::KeyEvent event1(xevent); | 216 ui::KeyEvent event1(xevent); |
217 NativeWebKeyboardEvent keydown_event(event1); | 217 NativeWebKeyboardEvent keydown_event(event1); |
218 SendNativeKeyEvent(keydown_event); | 218 SendNativeKeyEvent(keydown_event); |
219 | 219 |
220 // X11 doesn't actually have native character events, but give the test | 220 // X11 doesn't actually have native character events, but give the test |
221 // what it wants. | 221 // what it wants. |
222 xevent.InitKeyEvent(ui::ET_KEY_PRESSED, | 222 xevent.InitKeyEvent(ui::ET_KEY_PRESSED, |
223 static_cast<ui::KeyboardCode>(key_code), | 223 static_cast<ui::KeyboardCode>(key_code), |
224 flags); | 224 flags); |
225 ui::KeyEvent event2(xevent); | 225 ui::KeyEvent event2(xevent); |
226 event2.set_character(GetCharacterFromKeyCode(event2.key_code(), | 226 event2.set_character(DomCodeToCharacter(event2.code(), event2.flags())); |
227 event2.flags())); | |
228 ui::KeyEventTestApi test_event2(&event2); | 227 ui::KeyEventTestApi test_event2(&event2); |
229 test_event2.set_is_char(true); | 228 test_event2.set_is_char(true); |
230 NativeWebKeyboardEvent char_event(event2); | 229 NativeWebKeyboardEvent char_event(event2); |
231 SendNativeKeyEvent(char_event); | 230 SendNativeKeyEvent(char_event); |
232 | 231 |
233 xevent.InitKeyEvent(ui::ET_KEY_RELEASED, | 232 xevent.InitKeyEvent(ui::ET_KEY_RELEASED, |
234 static_cast<ui::KeyboardCode>(key_code), | 233 static_cast<ui::KeyboardCode>(key_code), |
235 flags); | 234 flags); |
236 ui::KeyEvent event3(xevent); | 235 ui::KeyEvent event3(xevent); |
237 NativeWebKeyboardEvent keyup_event(event3); | 236 NativeWebKeyboardEvent keyup_event(event3); |
238 SendNativeKeyEvent(keyup_event); | 237 SendNativeKeyEvent(keyup_event); |
239 | 238 |
240 long c = GetCharacterFromKeyCode(static_cast<ui::KeyboardCode>(key_code), | 239 ui::KeyboardCode keycode = static_cast<ui::KeyboardCode>(key_code); |
241 flags); | 240 ui::DomCode code = KeyboardCodeToDomCode(keycode); |
| 241 long c = DomCodeToCharacter(code, flags); |
242 output->assign(1, static_cast<base::char16>(c)); | 242 output->assign(1, static_cast<base::char16>(c)); |
243 return 1; | 243 return 1; |
244 #elif defined(USE_OZONE) | 244 #elif defined(USE_OZONE) |
245 const int flags = ConvertMockKeyboardModifier(modifiers); | 245 const int flags = ConvertMockKeyboardModifier(modifiers); |
246 | 246 |
247 ui::KeyEvent keydown_event(ui::ET_KEY_PRESSED, | 247 ui::KeyEvent keydown_event(ui::ET_KEY_PRESSED, |
248 static_cast<ui::KeyboardCode>(key_code), | 248 static_cast<ui::KeyboardCode>(key_code), |
249 flags); | 249 flags); |
250 NativeWebKeyboardEvent keydown_web_event(keydown_event); | 250 NativeWebKeyboardEvent keydown_web_event(keydown_event); |
251 SendNativeKeyEvent(keydown_web_event); | 251 SendNativeKeyEvent(keydown_web_event); |
252 | 252 |
253 ui::KeyEvent char_event(keydown_event.GetCharacter(), | 253 ui::KeyEvent char_event(keydown_event.GetCharacter(), |
254 static_cast<ui::KeyboardCode>(key_code), | 254 static_cast<ui::KeyboardCode>(key_code), |
255 flags); | 255 flags); |
256 NativeWebKeyboardEvent char_web_event(char_event); | 256 NativeWebKeyboardEvent char_web_event(char_event); |
257 SendNativeKeyEvent(char_web_event); | 257 SendNativeKeyEvent(char_web_event); |
258 | 258 |
259 ui::KeyEvent keyup_event(ui::ET_KEY_RELEASED, | 259 ui::KeyEvent keyup_event(ui::ET_KEY_RELEASED, |
260 static_cast<ui::KeyboardCode>(key_code), | 260 static_cast<ui::KeyboardCode>(key_code), |
261 flags); | 261 flags); |
262 NativeWebKeyboardEvent keyup_web_event(keyup_event); | 262 NativeWebKeyboardEvent keyup_web_event(keyup_event); |
263 SendNativeKeyEvent(keyup_web_event); | 263 SendNativeKeyEvent(keyup_web_event); |
264 | 264 |
265 long c = GetCharacterFromKeyCode(static_cast<ui::KeyboardCode>(key_code), | 265 ui::KeyboardCode keycode = static_cast<ui::KeyboardCode>(key_code); |
266 flags); | 266 ui::DomCode code = KeyboardCodeToDomCode(keycode); |
| 267 long c = DomCodeToCharacter(code, flags); |
267 output->assign(1, static_cast<base::char16>(c)); | 268 output->assign(1, static_cast<base::char16>(c)); |
268 return 1; | 269 return 1; |
269 #else | 270 #else |
270 NOTIMPLEMENTED(); | 271 NOTIMPLEMENTED(); |
271 return L'\0'; | 272 return L'\0'; |
272 #endif | 273 #endif |
273 } | 274 } |
274 | 275 |
275 void EnablePreferredSizeMode() { | 276 void EnablePreferredSizeMode() { |
276 view()->OnEnablePreferredSizeChangedMode(); | 277 view()->OnEnablePreferredSizeChangedMode(); |
(...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2422 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 2423 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( |
2423 &DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); | 2424 &DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); |
2424 ExecuteJavaScript("debugger;"); | 2425 ExecuteJavaScript("debugger;"); |
2425 | 2426 |
2426 // CloseWhilePaused should resume execution and continue here. | 2427 // CloseWhilePaused should resume execution and continue here. |
2427 EXPECT_FALSE(IsPaused()); | 2428 EXPECT_FALSE(IsPaused()); |
2428 Detach(); | 2429 Detach(); |
2429 } | 2430 } |
2430 | 2431 |
2431 } // namespace content | 2432 } // namespace content |
OLD | NEW |