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_TEST_TEST_RENDER_VIEW_HOST_H_ | 5 #ifndef CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ |
6 #define CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ | 6 #define CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "content/browser/renderer_host/render_view_host_impl.h" | 14 #include "content/browser/renderer_host/render_view_host_impl.h" |
15 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 15 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
16 #include "content/public/common/web_preferences.h" | 16 #include "content/public/common/web_preferences.h" |
| 17 #include "content/public/test/mock_render_process_host.h" |
17 #include "content/public/test/test_renderer_host.h" | 18 #include "content/public/test/test_renderer_host.h" |
18 #include "ui/base/ime/dummy_text_input_client.h" | 19 #include "ui/base/ime/dummy_text_input_client.h" |
19 #include "ui/base/layout.h" | 20 #include "ui/base/layout.h" |
20 #include "ui/base/page_transition_types.h" | 21 #include "ui/base/page_transition_types.h" |
21 #include "ui/gfx/geometry/vector2d_f.h" | 22 #include "ui/gfx/geometry/vector2d_f.h" |
22 | 23 |
23 // This file provides a testing framework for mocking out the RenderProcessHost | 24 // This file provides a testing framework for mocking out the RenderProcessHost |
24 // layer. It allows you to test RenderViewHost, WebContentsImpl, | 25 // layer. It allows you to test RenderViewHost, WebContentsImpl, |
25 // NavigationController, and other layers above that without running an actual | 26 // NavigationController, and other layers above that without running an actual |
26 // renderer process. | 27 // renderer process. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 #if defined(OS_ANDROID) | 128 #if defined(OS_ANDROID) |
128 void LockCompositingSurface() override {} | 129 void LockCompositingSurface() override {} |
129 void UnlockCompositingSurface() override {} | 130 void UnlockCompositingSurface() override {} |
130 #endif | 131 #endif |
131 void GetScreenInfo(blink::WebScreenInfo* results) override {} | 132 void GetScreenInfo(blink::WebScreenInfo* results) override {} |
132 gfx::Rect GetBoundsInRootWindow() override; | 133 gfx::Rect GetBoundsInRootWindow() override; |
133 gfx::GLSurfaceHandle GetCompositingSurface() override; | 134 gfx::GLSurfaceHandle GetCompositingSurface() override; |
134 bool LockMouse() override; | 135 bool LockMouse() override; |
135 void UnlockMouse() override; | 136 void UnlockMouse() override; |
136 #if defined(OS_WIN) | 137 #if defined(OS_WIN) |
137 virtual void SetParentNativeViewAccessible( | 138 void SetParentNativeViewAccessible( |
138 gfx::NativeViewAccessible accessible_parent) override; | 139 gfx::NativeViewAccessible accessible_parent) override; |
139 virtual gfx::NativeViewId GetParentForWindowlessPlugin() const override; | 140 gfx::NativeViewId GetParentForWindowlessPlugin() const override; |
140 #endif | 141 #endif |
141 | 142 |
142 bool is_showing() const { return is_showing_; } | 143 bool is_showing() const { return is_showing_; } |
143 bool is_occluded() const { return is_occluded_; } | 144 bool is_occluded() const { return is_occluded_; } |
144 bool did_swap_compositor_frame() const { return did_swap_compositor_frame_; } | 145 bool did_swap_compositor_frame() const { return did_swap_compositor_frame_; } |
145 | 146 |
146 protected: | 147 protected: |
147 RenderWidgetHostImpl* rwh_; | 148 RenderWidgetHostImpl* rwh_; |
148 | 149 |
149 private: | 150 private: |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // Sets whether the RenderView currently exists or not. This controls the | 227 // Sets whether the RenderView currently exists or not. This controls the |
227 // return value from IsRenderViewLive, which the rest of the system uses to | 228 // return value from IsRenderViewLive, which the rest of the system uses to |
228 // check whether the RenderView has crashed or not. | 229 // check whether the RenderView has crashed or not. |
229 void set_render_view_created(bool created) { | 230 void set_render_view_created(bool created) { |
230 render_view_created_ = created; | 231 render_view_created_ = created; |
231 } | 232 } |
232 | 233 |
233 // The opener route id passed to CreateRenderView(). | 234 // The opener route id passed to CreateRenderView(). |
234 int opener_route_id() const { return opener_route_id_; } | 235 int opener_route_id() const { return opener_route_id_; } |
235 | 236 |
| 237 // RenderWidgetHost overrides (same value, but in the Mock* type) |
| 238 MockRenderProcessHost* GetProcess() const override; |
| 239 |
236 // RenderViewHost overrides -------------------------------------------------- | 240 // RenderViewHost overrides -------------------------------------------------- |
237 | 241 |
238 bool CreateRenderView(const base::string16& frame_name, | 242 bool CreateRenderView(const base::string16& frame_name, |
239 int opener_route_id, | 243 int opener_route_id, |
240 int proxy_route_id, | 244 int proxy_route_id, |
241 int32 max_page_id, | 245 int32 max_page_id, |
242 bool window_was_created_with_opener) override; | 246 bool window_was_created_with_opener) override; |
243 bool IsRenderViewLive() const override; | 247 bool IsRenderViewLive() const override; |
244 bool IsFullscreenGranted() const override; | 248 bool IsFullscreenGranted() const override; |
245 | 249 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 private: | 325 private: |
322 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> | 326 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> |
323 ScopedSetSupportedScaleFactors; | 327 ScopedSetSupportedScaleFactors; |
324 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; | 328 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; |
325 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); | 329 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); |
326 }; | 330 }; |
327 | 331 |
328 } // namespace content | 332 } // namespace content |
329 | 333 |
330 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ | 334 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ |
OLD | NEW |