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