OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/test/render_view_test.h" | 5 #include "chrome/test/render_view_test.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 7 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
8 #include "chrome/common/dom_storage_common.h" | 8 #include "chrome/common/dom_storage_common.h" |
9 #include "chrome/common/extensions/extension.h" | 9 #include "chrome/common/extensions/extension.h" |
10 #include "chrome/common/native_web_keyboard_event.h" | 10 #include "chrome/common/native_web_keyboard_event.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h
" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h
" |
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" |
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
29 #include "webkit/glue/webkit_glue.h" | 29 #include "webkit/glue/webkit_glue.h" |
30 | 30 |
31 #if defined(OS_LINUX) | 31 #if defined(OS_LINUX) |
32 #include "app/event_synthesis_gtk.h" | 32 #include "ui/base/gtk/event_synthesis_gtk.h" |
33 #endif | 33 #endif |
34 | 34 |
35 using WebKit::WebFrame; | 35 using WebKit::WebFrame; |
36 using WebKit::WebInputEvent; | 36 using WebKit::WebInputEvent; |
37 using WebKit::WebMouseEvent; | 37 using WebKit::WebMouseEvent; |
38 using WebKit::WebScriptController; | 38 using WebKit::WebScriptController; |
39 using WebKit::WebScriptSource; | 39 using WebKit::WebScriptSource; |
40 using WebKit::WebString; | 40 using WebKit::WebString; |
41 using WebKit::WebURLRequest; | 41 using WebKit::WebURLRequest; |
42 | 42 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 SendNativeKeyEvent(char_event); | 206 SendNativeKeyEvent(char_event); |
207 | 207 |
208 NativeWebKeyboardEvent keyup_event(NULL, WM_KEYUP, key_code, 0); | 208 NativeWebKeyboardEvent keyup_event(NULL, WM_KEYUP, key_code, 0); |
209 SendNativeKeyEvent(keyup_event); | 209 SendNativeKeyEvent(keyup_event); |
210 | 210 |
211 return length; | 211 return length; |
212 #elif defined(OS_LINUX) | 212 #elif defined(OS_LINUX) |
213 // We ignore |layout|, which means we are only testing the layout of the | 213 // We ignore |layout|, which means we are only testing the layout of the |
214 // current locale. TODO(estade): fix this to respect |layout|. | 214 // current locale. TODO(estade): fix this to respect |layout|. |
215 std::vector<GdkEvent*> events; | 215 std::vector<GdkEvent*> events; |
216 app::SynthesizeKeyPressEvents( | 216 ui::SynthesizeKeyPressEvents( |
217 NULL, static_cast<ui::KeyboardCode>(key_code), | 217 NULL, static_cast<ui::KeyboardCode>(key_code), |
218 modifiers & (MockKeyboard::LEFT_CONTROL | MockKeyboard::RIGHT_CONTROL), | 218 modifiers & (MockKeyboard::LEFT_CONTROL | MockKeyboard::RIGHT_CONTROL), |
219 modifiers & (MockKeyboard::LEFT_SHIFT | MockKeyboard::RIGHT_SHIFT), | 219 modifiers & (MockKeyboard::LEFT_SHIFT | MockKeyboard::RIGHT_SHIFT), |
220 modifiers & (MockKeyboard::LEFT_ALT | MockKeyboard::RIGHT_ALT), | 220 modifiers & (MockKeyboard::LEFT_ALT | MockKeyboard::RIGHT_ALT), |
221 &events); | 221 &events); |
222 | 222 |
223 guint32 unicode_key = 0; | 223 guint32 unicode_key = 0; |
224 for (size_t i = 0; i < events.size(); ++i) { | 224 for (size_t i = 0; i < events.size(); ++i) { |
225 // Only send the up/down events for key press itself (skip the up/down | 225 // Only send the up/down events for key press itself (skip the up/down |
226 // events for the modifier keys). | 226 // events for the modifier keys). |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 mouse_event.x = bounds.CenterPoint().x(); | 345 mouse_event.x = bounds.CenterPoint().x(); |
346 mouse_event.y = bounds.CenterPoint().y(); | 346 mouse_event.y = bounds.CenterPoint().y(); |
347 mouse_event.clickCount = 1; | 347 mouse_event.clickCount = 1; |
348 ViewMsg_HandleInputEvent input_event(0); | 348 ViewMsg_HandleInputEvent input_event(0); |
349 scoped_ptr<IPC::Message> input_message(new ViewMsg_HandleInputEvent(0)); | 349 scoped_ptr<IPC::Message> input_message(new ViewMsg_HandleInputEvent(0)); |
350 input_message->WriteData(reinterpret_cast<const char*>(&mouse_event), | 350 input_message->WriteData(reinterpret_cast<const char*>(&mouse_event), |
351 sizeof(WebMouseEvent)); | 351 sizeof(WebMouseEvent)); |
352 view_->OnMessageReceived(*input_message); | 352 view_->OnMessageReceived(*input_message); |
353 return true; | 353 return true; |
354 } | 354 } |
OLD | NEW |