| 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/extensions/extension.h" | 8 #include "chrome/common/extensions/extension.h" |
| 9 #include "chrome/common/native_web_keyboard_event.h" | 9 #include "chrome/common/native_web_keyboard_event.h" |
| 10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| 11 #include "chrome/common/render_messages_params.h" | 11 #include "chrome/common/render_messages_params.h" |
| 12 #include "chrome/common/renderer_preferences.h" | 12 #include "chrome/common/renderer_preferences.h" |
| 13 #include "chrome/renderer/extensions/event_bindings.h" | 13 #include "chrome/renderer/extensions/event_bindings.h" |
| 14 #include "chrome/renderer/extensions/extension_process_bindings.h" | 14 #include "chrome/renderer/extensions/extension_process_bindings.h" |
| 15 #include "chrome/renderer/extensions/js_only_v8_extensions.h" | 15 #include "chrome/renderer/extensions/js_only_v8_extensions.h" |
| 16 #include "chrome/renderer/extensions/renderer_extension_bindings.h" | 16 #include "chrome/renderer/extensions/renderer_extension_bindings.h" |
| 17 #include "chrome/renderer/mock_render_process.h" | 17 #include "chrome/renderer/mock_render_process.h" |
| 18 #include "chrome/renderer/renderer_main_platform_delegate.h" | 18 #include "chrome/renderer/renderer_main_platform_delegate.h" |
| 19 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 19 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
| 20 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" | 20 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" |
| 21 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" | 21 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |
| 22 #include "third_party/WebKit/WebKit/chromium/public/WebScriptController.h" | 22 #include "third_party/WebKit/WebKit/chromium/public/WebScriptController.h" |
| 23 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" | 23 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" |
| 24 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" | 24 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" |
| 25 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 25 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
| 26 #include "webkit/glue/webkit_glue.h" | 26 #include "webkit/glue/webkit_glue.h" |
| 27 | 27 |
| 28 #if defined(OS_LINUX) | 28 #if defined(OS_LINUX) |
| 29 #include "base/event_synthesis_gtk.h" | 29 #include "app/event_synthesis_gtk.h" |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 using WebKit::WebFrame; | 32 using WebKit::WebFrame; |
| 33 using WebKit::WebScriptController; | 33 using WebKit::WebScriptController; |
| 34 using WebKit::WebScriptSource; | 34 using WebKit::WebScriptSource; |
| 35 using WebKit::WebString; | 35 using WebKit::WebString; |
| 36 using WebKit::WebURLRequest; | 36 using WebKit::WebURLRequest; |
| 37 | 37 |
| 38 namespace { | 38 namespace { |
| 39 const int32 kRouteId = 5; | 39 const int32 kRouteId = 5; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 SendNativeKeyEvent(char_event); | 181 SendNativeKeyEvent(char_event); |
| 182 | 182 |
| 183 NativeWebKeyboardEvent keyup_event(NULL, WM_KEYUP, key_code, 0); | 183 NativeWebKeyboardEvent keyup_event(NULL, WM_KEYUP, key_code, 0); |
| 184 SendNativeKeyEvent(keyup_event); | 184 SendNativeKeyEvent(keyup_event); |
| 185 | 185 |
| 186 return length; | 186 return length; |
| 187 #elif defined(OS_LINUX) | 187 #elif defined(OS_LINUX) |
| 188 // We ignore |layout|, which means we are only testing the layout of the | 188 // We ignore |layout|, which means we are only testing the layout of the |
| 189 // current locale. TODO(estade): fix this to respect |layout|. | 189 // current locale. TODO(estade): fix this to respect |layout|. |
| 190 std::vector<GdkEvent*> events; | 190 std::vector<GdkEvent*> events; |
| 191 base::SynthesizeKeyPressEvents( | 191 app::SynthesizeKeyPressEvents( |
| 192 NULL, static_cast<base::KeyboardCode>(key_code), | 192 NULL, static_cast<app::KeyboardCode>(key_code), |
| 193 modifiers & (MockKeyboard::LEFT_CONTROL | MockKeyboard::RIGHT_CONTROL), | 193 modifiers & (MockKeyboard::LEFT_CONTROL | MockKeyboard::RIGHT_CONTROL), |
| 194 modifiers & (MockKeyboard::LEFT_SHIFT | MockKeyboard::RIGHT_SHIFT), | 194 modifiers & (MockKeyboard::LEFT_SHIFT | MockKeyboard::RIGHT_SHIFT), |
| 195 modifiers & (MockKeyboard::LEFT_ALT | MockKeyboard::RIGHT_ALT), | 195 modifiers & (MockKeyboard::LEFT_ALT | MockKeyboard::RIGHT_ALT), |
| 196 &events); | 196 &events); |
| 197 | 197 |
| 198 guint32 unicode_key = 0; | 198 guint32 unicode_key = 0; |
| 199 for (size_t i = 0; i < events.size(); ++i) { | 199 for (size_t i = 0; i < events.size(); ++i) { |
| 200 // Only send the up/down events for key press itself (skip the up/down | 200 // Only send the up/down events for key press itself (skip the up/down |
| 201 // events for the modifier keys). | 201 // events for the modifier keys). |
| 202 if ((i + 1) == (events.size() / 2) || i == (events.size() / 2)) { | 202 if ((i + 1) == (events.size() / 2) || i == (events.size() / 2)) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 ViewHostMsg_DidPrintPage::Param post_did_print_page_param; | 257 ViewHostMsg_DidPrintPage::Param post_did_print_page_param; |
| 258 ViewHostMsg_DidPrintPage::Read(did_print_msg, &post_did_print_page_param); | 258 ViewHostMsg_DidPrintPage::Read(did_print_msg, &post_did_print_page_param); |
| 259 EXPECT_EQ(0, post_did_print_page_param.a.page_number); | 259 EXPECT_EQ(0, post_did_print_page_param.a.page_number); |
| 260 #elif defined(OS_LINUX) | 260 #elif defined(OS_LINUX) |
| 261 const IPC::Message* did_print_msg = | 261 const IPC::Message* did_print_msg = |
| 262 render_thread_.sink().GetUniqueMessageMatching( | 262 render_thread_.sink().GetUniqueMessageMatching( |
| 263 ViewHostMsg_TempFileForPrintingWritten::ID); | 263 ViewHostMsg_TempFileForPrintingWritten::ID); |
| 264 ASSERT_TRUE(did_print_msg); | 264 ASSERT_TRUE(did_print_msg); |
| 265 #endif | 265 #endif |
| 266 } | 266 } |
| OLD | NEW |