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/test/mock_render_thread.h" | 16 #include "content/public/test/mock_render_thread.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "third_party/WebKit/public/platform/Platform.h" | 18 #include "third_party/WebKit/public/platform/Platform.h" |
19 #include "third_party/WebKit/public/web/WebFrame.h" | 19 #include "third_party/WebKit/public/web/WebFrame.h" |
20 | 20 |
21 namespace blink { | 21 namespace blink { |
22 class WebHistoryItem; | |
23 class WebWidget; | 22 class WebWidget; |
24 } | 23 } |
25 | 24 |
26 namespace gfx { | 25 namespace gfx { |
27 class Rect; | 26 class Rect; |
28 } | 27 } |
29 | 28 |
30 namespace content { | 29 namespace content { |
31 class ContentBrowserClient; | 30 class ContentBrowserClient; |
32 class ContentClient; | 31 class ContentClient; |
33 class ContentRendererClient; | 32 class ContentRendererClient; |
34 class MockRenderProcess; | 33 class MockRenderProcess; |
| 34 class PageState; |
35 class RendererMainPlatformDelegate; | 35 class RendererMainPlatformDelegate; |
36 class RendererWebKitPlatformSupportImplNoSandboxImpl; | 36 class RendererWebKitPlatformSupportImplNoSandboxImpl; |
37 class RenderView; | 37 class RenderView; |
38 | 38 |
39 class RenderViewTest : public testing::Test { | 39 class RenderViewTest : public testing::Test { |
40 public: | 40 public: |
41 // A special WebKitPlatformSupportImpl class for getting rid off the | 41 // A special WebKitPlatformSupportImpl class for getting rid off the |
42 // dependency to the sandbox, which is not available in RenderViewTest. | 42 // dependency to the sandbox, which is not available in RenderViewTest. |
43 class RendererWebKitPlatformSupportImplNoSandbox { | 43 class RendererWebKitPlatformSupportImplNoSandbox { |
44 public: | 44 public: |
(...skipping 25 matching lines...) Expand all Loading... |
70 // Returns true if the JavaScript was evaluated correctly to an int value, | 70 // Returns true if the JavaScript was evaluated correctly to an int value, |
71 // false otherwise. | 71 // false otherwise. |
72 bool ExecuteJavaScriptAndReturnIntValue(const base::string16& script, | 72 bool ExecuteJavaScriptAndReturnIntValue(const base::string16& script, |
73 int* result); | 73 int* result); |
74 | 74 |
75 // Loads the given HTML into the main frame as a data: URL and blocks until | 75 // Loads the given HTML into the main frame as a data: URL and blocks until |
76 // the navigation is committed. | 76 // the navigation is committed. |
77 void LoadHTML(const char* html); | 77 void LoadHTML(const char* html); |
78 | 78 |
79 // Navigates the main frame back or forward in session history and commits. | 79 // Navigates the main frame back or forward in session history and commits. |
80 // The caller must capture a WebHistoryItem for the target page. This is | 80 // The caller must capture a PageState for the target page. |
81 // available from the WebFrame. | 81 void GoBack(const PageState& state); |
82 void GoBack(const blink::WebHistoryItem& item); | 82 void GoForward(const PageState& state); |
83 void GoForward(const blink::WebHistoryItem& item); | |
84 | 83 |
85 // Navigates the main frame back to whatever is considered the previous | 84 // Navigates the main frame back to whatever is considered the previous |
86 // history entry internally. | 85 // history entry internally. |
87 void GoBackToPrevious(); | 86 void GoBackToPrevious(); |
88 | 87 |
89 // Sends one native key event over IPC. | 88 // Sends one native key event over IPC. |
90 void SendNativeKeyEvent(const NativeWebKeyboardEvent& key_event); | 89 void SendNativeKeyEvent(const NativeWebKeyboardEvent& key_event); |
91 | 90 |
92 // Send a raw keyboard event to the renderer. | 91 // Send a raw keyboard event to the renderer. |
93 void SendWebKeyboardEvent(const blink::WebKeyboardEvent& key_event); | 92 void SendWebKeyboardEvent(const blink::WebKeyboardEvent& key_event); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // Used to setup the process so renderers can run. | 151 // Used to setup the process so renderers can run. |
153 scoped_ptr<RendererMainPlatformDelegate> platform_; | 152 scoped_ptr<RendererMainPlatformDelegate> platform_; |
154 scoped_ptr<MainFunctionParams> params_; | 153 scoped_ptr<MainFunctionParams> params_; |
155 scoped_ptr<base::CommandLine> command_line_; | 154 scoped_ptr<base::CommandLine> command_line_; |
156 | 155 |
157 #if defined(OS_MACOSX) | 156 #if defined(OS_MACOSX) |
158 scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; | 157 scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; |
159 #endif | 158 #endif |
160 | 159 |
161 private: | 160 private: |
162 void GoToOffset(int offset, const blink::WebHistoryItem& history_item); | 161 void GoToOffset(int offset, const PageState& state); |
163 }; | 162 }; |
164 | 163 |
165 } // namespace content | 164 } // namespace content |
166 | 165 |
167 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ | 166 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ |
OLD | NEW |