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/renderer/content_renderer_client.h" | |
17 #include "content/public/test/mock_render_thread.h" | 16 #include "content/public/test/mock_render_thread.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "third_party/WebKit/public/platform/Platform.h" | 18 #include "third_party/WebKit/public/platform/Platform.h" |
20 #include "third_party/WebKit/public/web/WebFrame.h" | 19 #include "third_party/WebKit/public/web/WebFrame.h" |
21 | 20 |
22 namespace blink { | 21 namespace blink { |
23 class WebHistoryItem; | 22 class WebHistoryItem; |
24 class WebWidget; | 23 class WebWidget; |
25 } | 24 } |
26 | 25 |
27 namespace gfx { | 26 namespace gfx { |
28 class Rect; | 27 class Rect; |
29 } | 28 } |
30 | 29 |
31 namespace content { | 30 namespace content { |
| 31 class ContentBrowserClient; |
| 32 class ContentClient; |
| 33 class ContentRendererClient; |
32 class MockRenderProcess; | 34 class MockRenderProcess; |
33 class RendererMainPlatformDelegate; | 35 class RendererMainPlatformDelegate; |
34 class RendererWebKitPlatformSupportImplNoSandboxImpl; | 36 class RendererWebKitPlatformSupportImplNoSandboxImpl; |
| 37 class RenderView; |
35 | 38 |
36 class RenderViewTest : public testing::Test { | 39 class RenderViewTest : public testing::Test { |
37 public: | 40 public: |
38 // A special WebKitPlatformSupportImpl class for getting rid off the | 41 // A special WebKitPlatformSupportImpl class for getting rid off the |
39 // dependency to the sandbox, which is not available in RenderViewTest. | 42 // dependency to the sandbox, which is not available in RenderViewTest. |
40 class RendererWebKitPlatformSupportImplNoSandbox { | 43 class RendererWebKitPlatformSupportImplNoSandbox { |
41 public: | 44 public: |
42 RendererWebKitPlatformSupportImplNoSandbox(); | 45 RendererWebKitPlatformSupportImplNoSandbox(); |
43 ~RendererWebKitPlatformSupportImplNoSandbox(); | 46 ~RendererWebKitPlatformSupportImplNoSandbox(); |
44 blink::Platform* Get(); | 47 blink::Platform* Get(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 void Resize(gfx::Size new_size, | 116 void Resize(gfx::Size new_size, |
114 gfx::Rect resizer_rect, | 117 gfx::Rect resizer_rect, |
115 bool is_fullscreen); | 118 bool is_fullscreen); |
116 | 119 |
117 // These are all methods from RenderViewImpl that we expose to testing code. | 120 // These are all methods from RenderViewImpl that we expose to testing code. |
118 bool OnMessageReceived(const IPC::Message& msg); | 121 bool OnMessageReceived(const IPC::Message& msg); |
119 void DidNavigateWithinPage(blink::WebFrame* frame, bool is_new_navigation); | 122 void DidNavigateWithinPage(blink::WebFrame* frame, bool is_new_navigation); |
120 void SendContentStateImmediately(); | 123 void SendContentStateImmediately(); |
121 blink::WebWidget* GetWebWidget(); | 124 blink::WebWidget* GetWebWidget(); |
122 | 125 |
| 126 // Allows a subclass to override the various content client implementations. |
| 127 virtual ContentClient* CreateContentClient(); |
| 128 virtual ContentBrowserClient* CreateContentBrowserClient(); |
| 129 virtual ContentRendererClient* CreateContentRendererClient(); |
| 130 |
123 // testing::Test | 131 // testing::Test |
124 virtual void SetUp() OVERRIDE; | 132 virtual void SetUp() OVERRIDE; |
125 | 133 |
126 virtual void TearDown() OVERRIDE; | 134 virtual void TearDown() OVERRIDE; |
127 | 135 |
128 base::MessageLoop msg_loop_; | 136 base::MessageLoop msg_loop_; |
129 scoped_ptr<MockRenderProcess> mock_process_; | 137 scoped_ptr<MockRenderProcess> mock_process_; |
130 // We use a naked pointer because we don't want to expose RenderViewImpl in | 138 // We use a naked pointer because we don't want to expose RenderViewImpl in |
131 // the embedder's namespace. | 139 // the embedder's namespace. |
132 RenderView* view_; | 140 RenderView* view_; |
133 RendererWebKitPlatformSupportImplNoSandbox webkit_platform_support_; | 141 RendererWebKitPlatformSupportImplNoSandbox webkit_platform_support_; |
134 ContentRendererClient content_renderer_client_; | 142 scoped_ptr<ContentClient> content_client_; |
| 143 scoped_ptr<ContentBrowserClient> content_browser_client_; |
| 144 scoped_ptr<ContentRendererClient> content_renderer_client_; |
135 scoped_ptr<MockRenderThread> render_thread_; | 145 scoped_ptr<MockRenderThread> render_thread_; |
136 | 146 |
137 // Used to setup the process so renderers can run. | 147 // Used to setup the process so renderers can run. |
138 scoped_ptr<RendererMainPlatformDelegate> platform_; | 148 scoped_ptr<RendererMainPlatformDelegate> platform_; |
139 scoped_ptr<MainFunctionParams> params_; | 149 scoped_ptr<MainFunctionParams> params_; |
140 scoped_ptr<CommandLine> command_line_; | 150 scoped_ptr<CommandLine> command_line_; |
141 | 151 |
142 #if defined(OS_MACOSX) | 152 #if defined(OS_MACOSX) |
143 scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; | 153 scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; |
144 #endif | 154 #endif |
145 | 155 |
146 private: | 156 private: |
147 void GoToOffset(int offset, const blink::WebHistoryItem& history_item); | 157 void GoToOffset(int offset, const blink::WebHistoryItem& history_item); |
148 }; | 158 }; |
149 | 159 |
150 } // namespace content | 160 } // namespace content |
151 | 161 |
152 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ | 162 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ |
OLD | NEW |