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 #ifndef CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ |
6 #define CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ | 6 #define CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "content/public/browser/native_web_keyboard_event.h" | 14 #include "content/public/browser/native_web_keyboard_event.h" |
15 #include "content/public/common/main_function_params.h" | 15 #include "content/public/common/main_function_params.h" |
16 #include "content/public/common/page_state.h" | 16 #include "content/public/common/page_state.h" |
17 #include "content/public/test/mock_render_thread.h" | 17 #include "content/public/test/mock_render_thread.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "third_party/WebKit/public/platform/Platform.h" | 19 #include "third_party/WebKit/public/platform/Platform.h" |
20 #include "third_party/WebKit/public/web/WebFrame.h" | 20 #include "third_party/WebKit/public/web/WebFrame.h" |
21 | 21 |
22 struct ViewMsg_Resize_Params; | 22 struct ViewMsg_Resize_Params; |
23 | 23 |
24 namespace blink { | 24 namespace blink { |
| 25 class WebInputElement; |
25 class WebWidget; | 26 class WebWidget; |
26 } | 27 } |
27 | 28 |
28 namespace gfx { | 29 namespace gfx { |
29 class Rect; | 30 class Rect; |
30 } | 31 } |
31 | 32 |
32 namespace scheduler { | 33 namespace scheduler { |
33 class RendererScheduler; | 34 class RendererScheduler; |
34 } | 35 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 void GoBack(const PageState& state); | 93 void GoBack(const PageState& state); |
93 void GoForward(const PageState& state); | 94 void GoForward(const PageState& state); |
94 | 95 |
95 // Sends one native key event over IPC. | 96 // Sends one native key event over IPC. |
96 void SendNativeKeyEvent(const NativeWebKeyboardEvent& key_event); | 97 void SendNativeKeyEvent(const NativeWebKeyboardEvent& key_event); |
97 | 98 |
98 // Send a raw keyboard event to the renderer. | 99 // Send a raw keyboard event to the renderer. |
99 void SendWebKeyboardEvent(const blink::WebKeyboardEvent& key_event); | 100 void SendWebKeyboardEvent(const blink::WebKeyboardEvent& key_event); |
100 | 101 |
101 // Send a raw mouse event to the renderer. | 102 // Send a raw mouse event to the renderer. |
102 void SendWebMouseEvent(const blink::WebMouseEvent& key_event); | 103 void SendWebMouseEvent(const blink::WebMouseEvent& mouse_event); |
103 | 104 |
104 // Returns the bounds (coordinates and size) of the element with id | 105 // Returns the bounds (coordinates and size) of the element with id |
105 // |element_id|. Returns an empty rect if such an element was not found. | 106 // |element_id|. Returns an empty rect if such an element was not found. |
106 gfx::Rect GetElementBounds(const std::string& element_id); | 107 gfx::Rect GetElementBounds(const std::string& element_id); |
107 | 108 |
108 // Sends a left mouse click in the middle of the element with id |element_id|. | 109 // Sends a left mouse click in the middle of the element with id |element_id|. |
109 // Returns true if the event was sent, false otherwise (typically because | 110 // Returns true if the event was sent, false otherwise (typically because |
110 // the element was not found). | 111 // the element was not found). |
111 bool SimulateElementClick(const std::string& element_id); | 112 bool SimulateElementClick(const std::string& element_id); |
112 | 113 |
(...skipping 10 matching lines...) Expand all Loading... |
123 void Reload(const GURL& url); | 124 void Reload(const GURL& url); |
124 | 125 |
125 // Returns the IPC message ID of the navigation message. | 126 // Returns the IPC message ID of the navigation message. |
126 uint32 GetNavigationIPCType(); | 127 uint32 GetNavigationIPCType(); |
127 | 128 |
128 // Resize the view. | 129 // Resize the view. |
129 void Resize(gfx::Size new_size, | 130 void Resize(gfx::Size new_size, |
130 gfx::Rect resizer_rect, | 131 gfx::Rect resizer_rect, |
131 bool is_fullscreen); | 132 bool is_fullscreen); |
132 | 133 |
| 134 // Simulates typing the |ascii_character| into this render view. Also accepts |
| 135 // ui::VKEY_BACK for backspace. Will flush the message loop if |
| 136 // |flush_message_loop| is true. |
| 137 void SimulateUserTypingASCIICharacter(char ascii_character, |
| 138 bool flush_message_loop); |
| 139 |
| 140 // Simulates user focusing |input|, erasing all text, and typing the |
| 141 // |new_value| instead. Will process input events for autofill. This is a user |
| 142 // gesture. |
| 143 void SimulateUserInputChangeForElement(blink::WebInputElement* input, |
| 144 const std::string& new_value); |
| 145 |
133 // These are all methods from RenderViewImpl that we expose to testing code. | 146 // These are all methods from RenderViewImpl that we expose to testing code. |
134 bool OnMessageReceived(const IPC::Message& msg); | 147 bool OnMessageReceived(const IPC::Message& msg); |
135 void DidNavigateWithinPage(blink::WebLocalFrame* frame, | 148 void DidNavigateWithinPage(blink::WebLocalFrame* frame, |
136 bool is_new_navigation); | 149 bool is_new_navigation); |
137 void SendContentStateImmediately(); | 150 void SendContentStateImmediately(); |
138 blink::WebWidget* GetWebWidget(); | 151 blink::WebWidget* GetWebWidget(); |
139 | 152 |
140 // Allows a subclass to override the various content client implementations. | 153 // Allows a subclass to override the various content client implementations. |
141 virtual ContentClient* CreateContentClient(); | 154 virtual ContentClient* CreateContentClient(); |
142 virtual ContentBrowserClient* CreateContentBrowserClient(); | 155 virtual ContentBrowserClient* CreateContentBrowserClient(); |
(...skipping 28 matching lines...) Expand all Loading... |
171 scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; | 184 scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; |
172 #endif | 185 #endif |
173 | 186 |
174 private: | 187 private: |
175 void GoToOffset(int offset, const PageState& state); | 188 void GoToOffset(int offset, const PageState& state); |
176 }; | 189 }; |
177 | 190 |
178 } // namespace content | 191 } // namespace content |
179 | 192 |
180 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ | 193 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ |
OLD | NEW |