| 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/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 ui::KeyEvent event1(xevent); | 222 ui::KeyEvent event1(xevent); |
| 223 NativeWebKeyboardEvent keydown_event(event1); | 223 NativeWebKeyboardEvent keydown_event(event1); |
| 224 SendNativeKeyEvent(keydown_event); | 224 SendNativeKeyEvent(keydown_event); |
| 225 | 225 |
| 226 // X11 doesn't actually have native character events, but give the test | 226 // X11 doesn't actually have native character events, but give the test |
| 227 // what it wants. | 227 // what it wants. |
| 228 xevent.InitKeyEvent(ui::ET_KEY_PRESSED, | 228 xevent.InitKeyEvent(ui::ET_KEY_PRESSED, |
| 229 static_cast<ui::KeyboardCode>(key_code), | 229 static_cast<ui::KeyboardCode>(key_code), |
| 230 flags); | 230 flags); |
| 231 ui::KeyEvent event2(xevent); | 231 ui::KeyEvent event2(xevent); |
| 232 event2.set_character(GetCharacterFromKeyCode(event2.key_code(), | 232 event2.set_character( |
| 233 event2.flags())); | 233 DomCodeToUsLayoutCharacter(event2.code(), event2.flags())); |
| 234 ui::KeyEventTestApi test_event2(&event2); | 234 ui::KeyEventTestApi test_event2(&event2); |
| 235 test_event2.set_is_char(true); | 235 test_event2.set_is_char(true); |
| 236 NativeWebKeyboardEvent char_event(event2); | 236 NativeWebKeyboardEvent char_event(event2); |
| 237 SendNativeKeyEvent(char_event); | 237 SendNativeKeyEvent(char_event); |
| 238 | 238 |
| 239 xevent.InitKeyEvent(ui::ET_KEY_RELEASED, | 239 xevent.InitKeyEvent(ui::ET_KEY_RELEASED, |
| 240 static_cast<ui::KeyboardCode>(key_code), | 240 static_cast<ui::KeyboardCode>(key_code), |
| 241 flags); | 241 flags); |
| 242 ui::KeyEvent event3(xevent); | 242 ui::KeyEvent event3(xevent); |
| 243 NativeWebKeyboardEvent keyup_event(event3); | 243 NativeWebKeyboardEvent keyup_event(event3); |
| 244 SendNativeKeyEvent(keyup_event); | 244 SendNativeKeyEvent(keyup_event); |
| 245 | 245 |
| 246 long c = GetCharacterFromKeyCode(static_cast<ui::KeyboardCode>(key_code), | 246 long c = DomCodeToUsLayoutCharacter( |
| 247 flags); | 247 UsLayoutKeyboardCodeToDomCode(static_cast<ui::KeyboardCode>(key_code)), |
| 248 flags); |
| 248 output->assign(1, static_cast<base::char16>(c)); | 249 output->assign(1, static_cast<base::char16>(c)); |
| 249 return 1; | 250 return 1; |
| 250 #elif defined(USE_OZONE) | 251 #elif defined(USE_OZONE) |
| 251 const int flags = ConvertMockKeyboardModifier(modifiers); | 252 const int flags = ConvertMockKeyboardModifier(modifiers); |
| 252 | 253 |
| 253 ui::KeyEvent keydown_event(ui::ET_KEY_PRESSED, | 254 ui::KeyEvent keydown_event(ui::ET_KEY_PRESSED, |
| 254 static_cast<ui::KeyboardCode>(key_code), | 255 static_cast<ui::KeyboardCode>(key_code), |
| 255 flags); | 256 flags); |
| 256 NativeWebKeyboardEvent keydown_web_event(keydown_event); | 257 NativeWebKeyboardEvent keydown_web_event(keydown_event); |
| 257 SendNativeKeyEvent(keydown_web_event); | 258 SendNativeKeyEvent(keydown_web_event); |
| 258 | 259 |
| 259 ui::KeyEvent char_event(keydown_event.GetCharacter(), | 260 ui::KeyEvent char_event(keydown_event.GetCharacter(), |
| 260 static_cast<ui::KeyboardCode>(key_code), | 261 static_cast<ui::KeyboardCode>(key_code), |
| 261 flags); | 262 flags); |
| 262 NativeWebKeyboardEvent char_web_event(char_event); | 263 NativeWebKeyboardEvent char_web_event(char_event); |
| 263 SendNativeKeyEvent(char_web_event); | 264 SendNativeKeyEvent(char_web_event); |
| 264 | 265 |
| 265 ui::KeyEvent keyup_event(ui::ET_KEY_RELEASED, | 266 ui::KeyEvent keyup_event(ui::ET_KEY_RELEASED, |
| 266 static_cast<ui::KeyboardCode>(key_code), | 267 static_cast<ui::KeyboardCode>(key_code), |
| 267 flags); | 268 flags); |
| 268 NativeWebKeyboardEvent keyup_web_event(keyup_event); | 269 NativeWebKeyboardEvent keyup_web_event(keyup_event); |
| 269 SendNativeKeyEvent(keyup_web_event); | 270 SendNativeKeyEvent(keyup_web_event); |
| 270 | 271 |
| 271 long c = GetCharacterFromKeyCode(static_cast<ui::KeyboardCode>(key_code), | 272 long c = DomCodeToUsLayoutCharacter( |
| 272 flags); | 273 UsLayoutKeyboardCodeToDomCode(static_cast<ui::KeyboardCode>(key_code)), |
| 274 flags); |
| 273 output->assign(1, static_cast<base::char16>(c)); | 275 output->assign(1, static_cast<base::char16>(c)); |
| 274 return 1; | 276 return 1; |
| 275 #else | 277 #else |
| 276 NOTIMPLEMENTED(); | 278 NOTIMPLEMENTED(); |
| 277 return L'\0'; | 279 return L'\0'; |
| 278 #endif | 280 #endif |
| 279 } | 281 } |
| 280 | 282 |
| 281 void EnablePreferredSizeMode() { | 283 void EnablePreferredSizeMode() { |
| 282 view()->OnEnablePreferredSizeChangedMode(); | 284 view()->OnEnablePreferredSizeChangedMode(); |
| (...skipping 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2390 FROM_HERE, | 2392 FROM_HERE, |
| 2391 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); | 2393 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); |
| 2392 ExecuteJavaScriptForTests("debugger;"); | 2394 ExecuteJavaScriptForTests("debugger;"); |
| 2393 | 2395 |
| 2394 // CloseWhilePaused should resume execution and continue here. | 2396 // CloseWhilePaused should resume execution and continue here. |
| 2395 EXPECT_FALSE(IsPaused()); | 2397 EXPECT_FALSE(IsPaused()); |
| 2396 Detach(); | 2398 Detach(); |
| 2397 } | 2399 } |
| 2398 | 2400 |
| 2399 } // namespace content | 2401 } // namespace content |
| OLD | NEW |