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 <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 #include <vector> | 11 #include <vector> |
10 | 12 |
11 #include "base/basictypes.h" | |
12 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" |
13 #include "build/build_config.h" | 15 #include "build/build_config.h" |
14 #include "content/browser/renderer_host/render_view_host_impl.h" | 16 #include "content/browser/renderer_host/render_view_host_impl.h" |
15 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 17 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
16 #include "content/public/common/web_preferences.h" | 18 #include "content/public/common/web_preferences.h" |
17 #include "content/public/test/mock_render_process_host.h" | 19 #include "content/public/test/mock_render_process_host.h" |
18 #include "content/public/test/test_renderer_host.h" | 20 #include "content/public/test/test_renderer_host.h" |
19 #include "ui/base/ime/dummy_text_input_client.h" | 21 #include "ui/base/ime/dummy_text_input_client.h" |
20 #include "ui/base/layout.h" | 22 #include "ui/base/layout.h" |
21 #include "ui/base/page_transition_types.h" | 23 #include "ui/base/page_transition_types.h" |
22 #include "ui/gfx/geometry/vector2d_f.h" | 24 #include "ui/gfx/geometry/vector2d_f.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 #if defined(OS_MACOSX) | 83 #if defined(OS_MACOSX) |
82 void SetActive(bool active) override; | 84 void SetActive(bool active) override; |
83 void SetWindowVisibility(bool visible) override {} | 85 void SetWindowVisibility(bool visible) override {} |
84 void WindowFrameChanged() override {} | 86 void WindowFrameChanged() override {} |
85 void ShowDefinitionForSelection() override {} | 87 void ShowDefinitionForSelection() override {} |
86 bool SupportsSpeech() const override; | 88 bool SupportsSpeech() const override; |
87 void SpeakSelection() override; | 89 void SpeakSelection() override; |
88 bool IsSpeaking() const override; | 90 bool IsSpeaking() const override; |
89 void StopSpeaking() override; | 91 void StopSpeaking() override; |
90 #endif // defined(OS_MACOSX) | 92 #endif // defined(OS_MACOSX) |
91 void OnSwapCompositorFrame(uint32 output_surface_id, | 93 void OnSwapCompositorFrame(uint32_t output_surface_id, |
92 scoped_ptr<cc::CompositorFrame> frame) override; | 94 scoped_ptr<cc::CompositorFrame> frame) override; |
93 void ClearCompositorFrame() override {} | 95 void ClearCompositorFrame() override {} |
94 | 96 |
95 // RenderWidgetHostViewBase implementation. | 97 // RenderWidgetHostViewBase implementation. |
96 void InitAsPopup(RenderWidgetHostView* parent_host_view, | 98 void InitAsPopup(RenderWidgetHostView* parent_host_view, |
97 const gfx::Rect& bounds) override {} | 99 const gfx::Rect& bounds) override {} |
98 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override {} | 100 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override {} |
99 void MovePluginWindows(const std::vector<WebPluginGeometry>& moves) override { | 101 void MovePluginWindows(const std::vector<WebPluginGeometry>& moves) override { |
100 } | 102 } |
101 void Focus() override {} | 103 void Focus() override {} |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // similar to (b) above, essentially it gets very tricky. By using | 198 // similar to (b) above, essentially it gets very tricky. By using |
197 // the split interface we avoid complexity within content and maintain | 199 // the split interface we avoid complexity within content and maintain |
198 // reasonable utility for embedders. | 200 // reasonable utility for embedders. |
199 class TestRenderViewHost | 201 class TestRenderViewHost |
200 : public RenderViewHostImpl, | 202 : public RenderViewHostImpl, |
201 public RenderViewHostTester { | 203 public RenderViewHostTester { |
202 public: | 204 public: |
203 TestRenderViewHost(SiteInstance* instance, | 205 TestRenderViewHost(SiteInstance* instance, |
204 RenderViewHostDelegate* delegate, | 206 RenderViewHostDelegate* delegate, |
205 RenderWidgetHostDelegate* widget_delegate, | 207 RenderWidgetHostDelegate* widget_delegate, |
206 int32 routing_id, | 208 int32_t routing_id, |
207 int32 main_frame_routing_id, | 209 int32_t main_frame_routing_id, |
208 bool swapped_out); | 210 bool swapped_out); |
209 ~TestRenderViewHost() override; | 211 ~TestRenderViewHost() override; |
210 | 212 |
211 // RenderViewHostTester implementation. Note that CreateRenderView | 213 // RenderViewHostTester implementation. Note that CreateRenderView |
212 // is not specified since it is synonymous with the one from | 214 // is not specified since it is synonymous with the one from |
213 // RenderViewHostImpl, see below. | 215 // RenderViewHostImpl, see below. |
214 void SimulateWasHidden() override; | 216 void SimulateWasHidden() override; |
215 void SimulateWasShown() override; | 217 void SimulateWasShown() override; |
216 WebPreferences TestComputeWebkitPrefs() override; | 218 WebPreferences TestComputeWebkitPrefs() override; |
217 | 219 |
218 void TestOnUpdateStateWithFile( | 220 void TestOnUpdateStateWithFile( |
219 int page_id, const base::FilePath& file_path); | 221 int page_id, const base::FilePath& file_path); |
220 | 222 |
221 void TestOnStartDragging(const DropData& drop_data); | 223 void TestOnStartDragging(const DropData& drop_data); |
222 | 224 |
223 // If set, *delete_counter is incremented when this object destructs. | 225 // If set, *delete_counter is incremented when this object destructs. |
224 void set_delete_counter(int* delete_counter) { | 226 void set_delete_counter(int* delete_counter) { |
225 delete_counter_ = delete_counter; | 227 delete_counter_ = delete_counter; |
226 } | 228 } |
227 | 229 |
228 // The opener frame route id passed to CreateRenderView(). | 230 // The opener frame route id passed to CreateRenderView(). |
229 int opener_frame_route_id() const { return opener_frame_route_id_; } | 231 int opener_frame_route_id() const { return opener_frame_route_id_; } |
230 | 232 |
231 // RenderWidgetHost overrides (same value, but in the Mock* type) | 233 // RenderWidgetHost overrides (same value, but in the Mock* type) |
232 MockRenderProcessHost* GetProcess() const override; | 234 MockRenderProcessHost* GetProcess() const override; |
233 | 235 |
234 bool CreateTestRenderView(const base::string16& frame_name, | 236 bool CreateTestRenderView(const base::string16& frame_name, |
235 int opener_frame_route_id, | 237 int opener_frame_route_id, |
236 int proxy_route_id, | 238 int proxy_route_id, |
237 int32 max_page_id, | 239 int32_t max_page_id, |
238 bool window_was_created_with_opener) override; | 240 bool window_was_created_with_opener) override; |
239 | 241 |
240 // RenderViewHost overrides -------------------------------------------------- | 242 // RenderViewHost overrides -------------------------------------------------- |
241 | 243 |
242 bool CreateRenderView(int opener_frame_route_id, | 244 bool CreateRenderView(int opener_frame_route_id, |
243 int proxy_route_id, | 245 int proxy_route_id, |
244 int32 max_page_id, | 246 int32_t max_page_id, |
245 const FrameReplicationState& replicated_frame_state, | 247 const FrameReplicationState& replicated_frame_state, |
246 bool window_was_created_with_opener) override; | 248 bool window_was_created_with_opener) override; |
247 | 249 |
248 private: | 250 private: |
249 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate); | 251 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate); |
250 | 252 |
251 void SendNavigateWithTransitionAndResponseCode(int page_id, | 253 void SendNavigateWithTransitionAndResponseCode(int page_id, |
252 const GURL& url, | 254 const GURL& url, |
253 ui::PageTransition transition, | 255 ui::PageTransition transition, |
254 int response_code); | 256 int response_code); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 private: | 321 private: |
320 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> | 322 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> |
321 ScopedSetSupportedScaleFactors; | 323 ScopedSetSupportedScaleFactors; |
322 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; | 324 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; |
323 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); | 325 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); |
324 }; | 326 }; |
325 | 327 |
326 } // namespace content | 328 } // namespace content |
327 | 329 |
328 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ | 330 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ |
OLD | NEW |