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; | |
39 class TestWebContents; | 38 class TestWebContents; |
40 | 39 |
41 // Utility function to initialize ViewHostMsg_NavigateParams_Params | 40 // Utility function to initialize ViewHostMsg_NavigateParams_Params |
42 // with given |page_id|, |url| and |transition_type|. | 41 // with given |page_id|, |url| and |transition_type|. |
43 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, | 42 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, |
44 int page_id, | 43 int page_id, |
45 const GURL& url, | 44 const GURL& url, |
46 PageTransition transition_type); | 45 PageTransition transition_type); |
47 | 46 |
48 // TestRenderViewHostView ------------------------------------------------------ | 47 // TestRenderViewHostView ------------------------------------------------------ |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // The reason we do it this way instead of using composition is | 227 // The reason we do it this way instead of using composition is |
229 // similar to (b) above, essentially it gets very tricky. By using | 228 // similar to (b) above, essentially it gets very tricky. By using |
230 // the split interface we avoid complexity within content and maintain | 229 // the split interface we avoid complexity within content and maintain |
231 // reasonable utility for embedders. | 230 // reasonable utility for embedders. |
232 class TestRenderViewHost | 231 class TestRenderViewHost |
233 : public RenderViewHostImpl, | 232 : public RenderViewHostImpl, |
234 public RenderViewHostTester { | 233 public RenderViewHostTester { |
235 public: | 234 public: |
236 TestRenderViewHost(SiteInstance* instance, | 235 TestRenderViewHost(SiteInstance* instance, |
237 RenderViewHostDelegate* delegate, | 236 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 | |
325 // RenderViewHost overrides -------------------------------------------------- | 317 // RenderViewHost overrides -------------------------------------------------- |
326 | 318 |
327 virtual bool CreateRenderView(const base::string16& frame_name, | 319 virtual bool CreateRenderView(const base::string16& frame_name, |
328 int opener_route_id, | 320 int opener_route_id, |
329 int32 max_page_id) OVERRIDE; | 321 int32 max_page_id) OVERRIDE; |
330 virtual bool IsRenderViewLive() const OVERRIDE; | 322 virtual bool IsRenderViewLive() const OVERRIDE; |
331 | 323 |
332 private: | 324 private: |
333 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate); | 325 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate); |
334 | 326 |
(...skipping 25 matching lines...) Expand all Loading... |
360 | 352 |
361 // See set_simulate_history_list_was_cleared() above. | 353 // See set_simulate_history_list_was_cleared() above. |
362 bool simulate_history_list_was_cleared_; | 354 bool simulate_history_list_was_cleared_; |
363 | 355 |
364 // See SetContentsMimeType() above. | 356 // See SetContentsMimeType() above. |
365 std::string contents_mime_type_; | 357 std::string contents_mime_type_; |
366 | 358 |
367 // See opener_route_id() above. | 359 // See opener_route_id() above. |
368 int opener_route_id_; | 360 int opener_route_id_; |
369 | 361 |
370 TestRenderFrameHost* main_render_frame_host_; | |
371 | |
372 DISALLOW_COPY_AND_ASSIGN(TestRenderViewHost); | 362 DISALLOW_COPY_AND_ASSIGN(TestRenderViewHost); |
373 }; | 363 }; |
374 | 364 |
375 #if defined(COMPILER_MSVC) | 365 #if defined(COMPILER_MSVC) |
376 #pragma warning(pop) | 366 #pragma warning(pop) |
377 #endif | 367 #endif |
378 | 368 |
379 // Adds methods to get straight at the impl classes. | 369 // Adds methods to get straight at the impl classes. |
380 class RenderViewHostImplTestHarness : public RenderViewHostTestHarness { | 370 class RenderViewHostImplTestHarness : public RenderViewHostTestHarness { |
381 public: | 371 public: |
382 RenderViewHostImplTestHarness(); | 372 RenderViewHostImplTestHarness(); |
383 virtual ~RenderViewHostImplTestHarness(); | 373 virtual ~RenderViewHostImplTestHarness(); |
384 | 374 |
385 TestRenderViewHost* test_rvh(); | 375 TestRenderViewHost* test_rvh(); |
386 TestRenderViewHost* pending_test_rvh(); | 376 TestRenderViewHost* pending_test_rvh(); |
387 TestRenderViewHost* active_test_rvh(); | 377 TestRenderViewHost* active_test_rvh(); |
388 TestRenderFrameHost* main_test_rfh(); | 378 TestRenderFrameHost* main_test_rfh(); |
389 TestWebContents* contents(); | 379 TestWebContents* contents(); |
390 | 380 |
391 private: | 381 private: |
392 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> | 382 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> |
393 ScopedSetSupportedScaleFactors; | 383 ScopedSetSupportedScaleFactors; |
394 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; | 384 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; |
395 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); | 385 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); |
396 }; | 386 }; |
397 | 387 |
398 } // namespace content | 388 } // namespace content |
399 | 389 |
400 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ | 390 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ |
OLD | NEW |