| 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 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 struct ViewHostMsg_FrameNavigate_Params; | 29 struct ViewHostMsg_FrameNavigate_Params; |
| 30 | 30 |
| 31 namespace gfx { | 31 namespace gfx { |
| 32 class Rect; | 32 class Rect; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace content { | 35 namespace content { |
| 36 | 36 |
| 37 class SiteInstance; | 37 class SiteInstance; |
| 38 class TestRenderFrameHost; |
| 38 class TestWebContents; | 39 class TestWebContents; |
| 39 | 40 |
| 40 // Utility function to initialize ViewHostMsg_NavigateParams_Params | 41 // Utility function to initialize ViewHostMsg_NavigateParams_Params |
| 41 // with given |page_id|, |url| and |transition_type|. | 42 // with given |page_id|, |url| and |transition_type|. |
| 42 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, | 43 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, |
| 43 int page_id, | 44 int page_id, |
| 44 const GURL& url, | 45 const GURL& url, |
| 45 PageTransition transition_type); | 46 PageTransition transition_type); |
| 46 | 47 |
| 47 // TestRenderViewHostView ------------------------------------------------------ | 48 // TestRenderViewHostView ------------------------------------------------------ |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 // The reason we do it this way instead of using composition is | 228 // The reason we do it this way instead of using composition is |
| 228 // similar to (b) above, essentially it gets very tricky. By using | 229 // similar to (b) above, essentially it gets very tricky. By using |
| 229 // the split interface we avoid complexity within content and maintain | 230 // the split interface we avoid complexity within content and maintain |
| 230 // reasonable utility for embedders. | 231 // reasonable utility for embedders. |
| 231 class TestRenderViewHost | 232 class TestRenderViewHost |
| 232 : public RenderViewHostImpl, | 233 : public RenderViewHostImpl, |
| 233 public RenderViewHostTester { | 234 public RenderViewHostTester { |
| 234 public: | 235 public: |
| 235 TestRenderViewHost(SiteInstance* instance, | 236 TestRenderViewHost(SiteInstance* instance, |
| 236 RenderViewHostDelegate* delegate, | 237 RenderViewHostDelegate* delegate, |
| 237 RenderFrameHostDelegate* frame_delegate, | |
| 238 RenderWidgetHostDelegate* widget_delegate, | 238 RenderWidgetHostDelegate* widget_delegate, |
| 239 int routing_id, | 239 int routing_id, |
| 240 int main_frame_routing_id, | 240 int main_frame_routing_id, |
| 241 bool swapped_out); | 241 bool swapped_out); |
| 242 virtual ~TestRenderViewHost(); | 242 virtual ~TestRenderViewHost(); |
| 243 | 243 |
| 244 // RenderViewHostTester implementation. Note that CreateRenderView | 244 // RenderViewHostTester implementation. Note that CreateRenderView |
| 245 // is not specified since it is synonymous with the one from | 245 // is not specified since it is synonymous with the one from |
| 246 // RenderViewHostImpl, see below. | 246 // RenderViewHostImpl, see below. |
| 247 virtual void SendNavigate(int page_id, const GURL& url) OVERRIDE; | 247 virtual void SendNavigate(int page_id, const GURL& url) OVERRIDE; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 void set_simulate_fetch_via_proxy(bool proxy); | 307 void set_simulate_fetch_via_proxy(bool proxy); |
| 308 | 308 |
| 309 // If set, navigations will appear to have cleared the history list in the | 309 // If set, navigations will appear to have cleared the history list in the |
| 310 // RenderView (ViewHostMsg_FrameNavigate_Params::history_list_was_cleared). | 310 // RenderView (ViewHostMsg_FrameNavigate_Params::history_list_was_cleared). |
| 311 // False by default. | 311 // False by default. |
| 312 void set_simulate_history_list_was_cleared(bool cleared); | 312 void set_simulate_history_list_was_cleared(bool cleared); |
| 313 | 313 |
| 314 // The opener route id passed to CreateRenderView(). | 314 // The opener route id passed to CreateRenderView(). |
| 315 int opener_route_id() const { return opener_route_id_; } | 315 int opener_route_id() const { return opener_route_id_; } |
| 316 | 316 |
| 317 // TODO(creis): Remove the need for these methods. |
| 318 TestRenderFrameHost* main_render_frame_host() const { |
| 319 return main_render_frame_host_; |
| 320 } |
| 321 void set_main_render_frame_host(TestRenderFrameHost* rfh) { |
| 322 main_render_frame_host_ = rfh; |
| 323 } |
| 324 |
| 317 // RenderViewHost overrides -------------------------------------------------- | 325 // RenderViewHost overrides -------------------------------------------------- |
| 318 | 326 |
| 319 virtual bool CreateRenderView(const base::string16& frame_name, | 327 virtual bool CreateRenderView(const base::string16& frame_name, |
| 320 int opener_route_id, | 328 int opener_route_id, |
| 321 int32 max_page_id) OVERRIDE; | 329 int32 max_page_id) OVERRIDE; |
| 322 virtual bool IsRenderViewLive() const OVERRIDE; | 330 virtual bool IsRenderViewLive() const OVERRIDE; |
| 323 | 331 |
| 324 private: | 332 private: |
| 325 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate); | 333 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate); |
| 326 | 334 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 352 | 360 |
| 353 // See set_simulate_history_list_was_cleared() above. | 361 // See set_simulate_history_list_was_cleared() above. |
| 354 bool simulate_history_list_was_cleared_; | 362 bool simulate_history_list_was_cleared_; |
| 355 | 363 |
| 356 // See SetContentsMimeType() above. | 364 // See SetContentsMimeType() above. |
| 357 std::string contents_mime_type_; | 365 std::string contents_mime_type_; |
| 358 | 366 |
| 359 // See opener_route_id() above. | 367 // See opener_route_id() above. |
| 360 int opener_route_id_; | 368 int opener_route_id_; |
| 361 | 369 |
| 370 TestRenderFrameHost* main_render_frame_host_; |
| 371 |
| 362 DISALLOW_COPY_AND_ASSIGN(TestRenderViewHost); | 372 DISALLOW_COPY_AND_ASSIGN(TestRenderViewHost); |
| 363 }; | 373 }; |
| 364 | 374 |
| 365 #if defined(COMPILER_MSVC) | 375 #if defined(COMPILER_MSVC) |
| 366 #pragma warning(pop) | 376 #pragma warning(pop) |
| 367 #endif | 377 #endif |
| 368 | 378 |
| 369 // Adds methods to get straight at the impl classes. | 379 // Adds methods to get straight at the impl classes. |
| 370 class RenderViewHostImplTestHarness : public RenderViewHostTestHarness { | 380 class RenderViewHostImplTestHarness : public RenderViewHostTestHarness { |
| 371 public: | 381 public: |
| 372 RenderViewHostImplTestHarness(); | 382 RenderViewHostImplTestHarness(); |
| 373 virtual ~RenderViewHostImplTestHarness(); | 383 virtual ~RenderViewHostImplTestHarness(); |
| 374 | 384 |
| 375 TestRenderViewHost* test_rvh(); | 385 TestRenderViewHost* test_rvh(); |
| 376 TestRenderViewHost* pending_test_rvh(); | 386 TestRenderViewHost* pending_test_rvh(); |
| 377 TestRenderViewHost* active_test_rvh(); | 387 TestRenderViewHost* active_test_rvh(); |
| 378 TestRenderFrameHost* main_test_rfh(); | 388 TestRenderFrameHost* main_test_rfh(); |
| 379 TestWebContents* contents(); | 389 TestWebContents* contents(); |
| 380 | 390 |
| 381 private: | 391 private: |
| 382 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> | 392 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> |
| 383 ScopedSetSupportedScaleFactors; | 393 ScopedSetSupportedScaleFactors; |
| 384 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; | 394 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; |
| 385 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); | 395 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); |
| 386 }; | 396 }; |
| 387 | 397 |
| 388 } // namespace content | 398 } // namespace content |
| 389 | 399 |
| 390 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ | 400 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ |
| OLD | NEW |