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( |
227 event2.flags())); | 227 DomCodeToUsLayoutCharacter(event2.code(), event2.flags())); |
228 ui::KeyEventTestApi test_event2(&event2); | 228 ui::KeyEventTestApi test_event2(&event2); |
229 test_event2.set_is_char(true); | 229 test_event2.set_is_char(true); |
230 NativeWebKeyboardEvent char_event(event2); | 230 NativeWebKeyboardEvent char_event(event2); |
231 SendNativeKeyEvent(char_event); | 231 SendNativeKeyEvent(char_event); |
232 | 232 |
233 xevent.InitKeyEvent(ui::ET_KEY_RELEASED, | 233 xevent.InitKeyEvent(ui::ET_KEY_RELEASED, |
234 static_cast<ui::KeyboardCode>(key_code), | 234 static_cast<ui::KeyboardCode>(key_code), |
235 flags); | 235 flags); |
236 ui::KeyEvent event3(xevent); | 236 ui::KeyEvent event3(xevent); |
237 NativeWebKeyboardEvent keyup_event(event3); | 237 NativeWebKeyboardEvent keyup_event(event3); |
238 SendNativeKeyEvent(keyup_event); | 238 SendNativeKeyEvent(keyup_event); |
239 | 239 |
240 long c = GetCharacterFromKeyCode(static_cast<ui::KeyboardCode>(key_code), | 240 long c = DomCodeToUsLayoutCharacter( |
241 flags); | 241 UsLayoutKeyboardCodeToDomCode(static_cast<ui::KeyboardCode>(key_code)), |
| 242 flags); |
242 output->assign(1, static_cast<base::char16>(c)); | 243 output->assign(1, static_cast<base::char16>(c)); |
243 return 1; | 244 return 1; |
244 #elif defined(USE_OZONE) | 245 #elif defined(USE_OZONE) |
245 const int flags = ConvertMockKeyboardModifier(modifiers); | 246 const int flags = ConvertMockKeyboardModifier(modifiers); |
246 | 247 |
247 ui::KeyEvent keydown_event(ui::ET_KEY_PRESSED, | 248 ui::KeyEvent keydown_event(ui::ET_KEY_PRESSED, |
248 static_cast<ui::KeyboardCode>(key_code), | 249 static_cast<ui::KeyboardCode>(key_code), |
249 flags); | 250 flags); |
250 NativeWebKeyboardEvent keydown_web_event(keydown_event); | 251 NativeWebKeyboardEvent keydown_web_event(keydown_event); |
251 SendNativeKeyEvent(keydown_web_event); | 252 SendNativeKeyEvent(keydown_web_event); |
252 | 253 |
253 ui::KeyEvent char_event(keydown_event.GetCharacter(), | 254 ui::KeyEvent char_event(keydown_event.GetCharacter(), |
254 static_cast<ui::KeyboardCode>(key_code), | 255 static_cast<ui::KeyboardCode>(key_code), |
255 flags); | 256 flags); |
256 NativeWebKeyboardEvent char_web_event(char_event); | 257 NativeWebKeyboardEvent char_web_event(char_event); |
257 SendNativeKeyEvent(char_web_event); | 258 SendNativeKeyEvent(char_web_event); |
258 | 259 |
259 ui::KeyEvent keyup_event(ui::ET_KEY_RELEASED, | 260 ui::KeyEvent keyup_event(ui::ET_KEY_RELEASED, |
260 static_cast<ui::KeyboardCode>(key_code), | 261 static_cast<ui::KeyboardCode>(key_code), |
261 flags); | 262 flags); |
262 NativeWebKeyboardEvent keyup_web_event(keyup_event); | 263 NativeWebKeyboardEvent keyup_web_event(keyup_event); |
263 SendNativeKeyEvent(keyup_web_event); | 264 SendNativeKeyEvent(keyup_web_event); |
264 | 265 |
265 long c = GetCharacterFromKeyCode(static_cast<ui::KeyboardCode>(key_code), | 266 long c = DomCodeToUsLayoutCharacter( |
266 flags); | 267 UsLayoutKeyboardCodeToDomCode(static_cast<ui::KeyboardCode>(key_code)), |
| 268 flags); |
267 output->assign(1, static_cast<base::char16>(c)); | 269 output->assign(1, static_cast<base::char16>(c)); |
268 return 1; | 270 return 1; |
269 #else | 271 #else |
270 NOTIMPLEMENTED(); | 272 NOTIMPLEMENTED(); |
271 return L'\0'; | 273 return L'\0'; |
272 #endif | 274 #endif |
273 } | 275 } |
274 | 276 |
275 void EnablePreferredSizeMode() { | 277 void EnablePreferredSizeMode() { |
276 view()->OnEnablePreferredSizeChangedMode(); | 278 view()->OnEnablePreferredSizeChangedMode(); |
(...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2412 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 2414 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( |
2413 &DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); | 2415 &DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); |
2414 ExecuteJavaScript("debugger;"); | 2416 ExecuteJavaScript("debugger;"); |
2415 | 2417 |
2416 // CloseWhilePaused should resume execution and continue here. | 2418 // CloseWhilePaused should resume execution and continue here. |
2417 EXPECT_FALSE(IsPaused()); | 2419 EXPECT_FALSE(IsPaused()); |
2418 Detach(); | 2420 Detach(); |
2419 } | 2421 } |
2420 | 2422 |
2421 } // namespace content | 2423 } // namespace content |
OLD | NEW |