| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_TEST_RENDER_VIEW_TEST_H_ | 5 #ifndef CONTENT_TEST_RENDER_VIEW_TEST_H_ |
| 6 #define CONTENT_TEST_RENDER_VIEW_TEST_H_ | 6 #define CONTENT_TEST_RENDER_VIEW_TEST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/string16.h" |
| 14 #include "content/public/browser/native_web_keyboard_event.h" | 15 #include "content/public/browser/native_web_keyboard_event.h" |
| 15 #include "content/public/common/main_function_params.h" | 16 #include "content/public/common/main_function_params.h" |
| 16 #include "content/renderer/mock_content_renderer_client.h" | 17 #include "content/renderer/mock_content_renderer_client.h" |
| 17 #include "content/renderer/renderer_webkitplatformsupport_impl.h" | 18 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
| 18 #include "content/test/mock_keyboard.h" | 19 #include "content/test/mock_keyboard.h" |
| 19 #include "content/test/mock_render_thread.h" | 20 #include "content/test/mock_render_thread.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 22 | 23 |
| 23 class MockRenderProcess; | 24 class MockRenderProcess; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // false otherwise. | 70 // false otherwise. |
| 70 bool ExecuteJavaScriptAndReturnIntValue(const string16& script, int* result); | 71 bool ExecuteJavaScriptAndReturnIntValue(const string16& script, int* result); |
| 71 | 72 |
| 72 // Loads the given HTML into the main frame as a data: URL. | 73 // Loads the given HTML into the main frame as a data: URL. |
| 73 void LoadHTML(const char* html); | 74 void LoadHTML(const char* html); |
| 74 | 75 |
| 75 // Sends IPC messages that emulates a key-press event. | 76 // Sends IPC messages that emulates a key-press event. |
| 76 int SendKeyEvent(MockKeyboard::Layout layout, | 77 int SendKeyEvent(MockKeyboard::Layout layout, |
| 77 int key_code, | 78 int key_code, |
| 78 MockKeyboard::Modifiers key_modifiers, | 79 MockKeyboard::Modifiers key_modifiers, |
| 79 std::wstring* output); | 80 string16* output); |
| 80 | 81 |
| 81 // Sends one native key event over IPC. | 82 // Sends one native key event over IPC. |
| 82 void SendNativeKeyEvent(const NativeWebKeyboardEvent& key_event); | 83 void SendNativeKeyEvent(const NativeWebKeyboardEvent& key_event); |
| 83 | 84 |
| 84 // Send a raw keyboard event to the renderer. | 85 // Send a raw keyboard event to the renderer. |
| 85 void SendWebKeyboardEvent(const WebKit::WebKeyboardEvent& key_event); | 86 void SendWebKeyboardEvent(const WebKit::WebKeyboardEvent& key_event); |
| 86 | 87 |
| 87 // Returns the bounds (coordinates and size) of the element with id | 88 // Returns the bounds (coordinates and size) of the element with id |
| 88 // |element_id|. Returns an empty rect if such an element was not found. | 89 // |element_id|. Returns an empty rect if such an element was not found. |
| 89 gfx::Rect GetElementBounds(const std::string& element_id); | 90 gfx::Rect GetElementBounds(const std::string& element_id); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 126 |
| 126 // Used to setup the process so renderers can run. | 127 // Used to setup the process so renderers can run. |
| 127 scoped_ptr<RendererMainPlatformDelegate> platform_; | 128 scoped_ptr<RendererMainPlatformDelegate> platform_; |
| 128 scoped_ptr<content::MainFunctionParams> params_; | 129 scoped_ptr<content::MainFunctionParams> params_; |
| 129 scoped_ptr<CommandLine> command_line_; | 130 scoped_ptr<CommandLine> command_line_; |
| 130 }; | 131 }; |
| 131 | 132 |
| 132 } // namespace content | 133 } // namespace content |
| 133 | 134 |
| 134 #endif // CONTENT_TEST_RENDER_VIEW_TEST_H_ | 135 #endif // CONTENT_TEST_RENDER_VIEW_TEST_H_ |
| OLD | NEW |