Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: content/test/test_render_view_host.h

Issue 117693002: Make RenderFrameHostManager swap RenderFrameHosts, not RenderViewHosts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // 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
227 // similar to (b) above, essentially it gets very tricky. By using 228 // similar to (b) above, essentially it gets very tricky. By using
228 // the split interface we avoid complexity within content and maintain 229 // the split interface we avoid complexity within content and maintain
229 // reasonable utility for embedders. 230 // reasonable utility for embedders.
230 class TestRenderViewHost 231 class TestRenderViewHost
231 : public RenderViewHostImpl, 232 : public RenderViewHostImpl,
232 public RenderViewHostTester { 233 public RenderViewHostTester {
233 public: 234 public:
234 TestRenderViewHost(SiteInstance* instance, 235 TestRenderViewHost(SiteInstance* instance,
235 RenderViewHostDelegate* delegate, 236 RenderViewHostDelegate* delegate,
236 RenderFrameHostDelegate* frame_delegate,
237 RenderWidgetHostDelegate* widget_delegate, 237 RenderWidgetHostDelegate* widget_delegate,
238 int routing_id, 238 int routing_id,
239 int main_frame_routing_id, 239 int main_frame_routing_id,
240 bool swapped_out); 240 bool swapped_out);
241 virtual ~TestRenderViewHost(); 241 virtual ~TestRenderViewHost();
242 242
243 // RenderViewHostTester implementation. Note that CreateRenderView 243 // RenderViewHostTester implementation. Note that CreateRenderView
244 // is not specified since it is synonymous with the one from 244 // is not specified since it is synonymous with the one from
245 // RenderViewHostImpl, see below. 245 // RenderViewHostImpl, see below.
246 virtual void SendNavigate(int page_id, const GURL& url) OVERRIDE; 246 virtual void SendNavigate(int page_id, const GURL& url) OVERRIDE;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 void set_simulate_fetch_via_proxy(bool proxy); 306 void set_simulate_fetch_via_proxy(bool proxy);
307 307
308 // If set, navigations will appear to have cleared the history list in the 308 // If set, navigations will appear to have cleared the history list in the
309 // RenderView (ViewHostMsg_FrameNavigate_Params::history_list_was_cleared). 309 // RenderView (ViewHostMsg_FrameNavigate_Params::history_list_was_cleared).
310 // False by default. 310 // False by default.
311 void set_simulate_history_list_was_cleared(bool cleared); 311 void set_simulate_history_list_was_cleared(bool cleared);
312 312
313 // The opener route id passed to CreateRenderView(). 313 // The opener route id passed to CreateRenderView().
314 int opener_route_id() const { return opener_route_id_; } 314 int opener_route_id() const { return opener_route_id_; }
315 315
316 // TODO(creis): Remove the need for these methods.
317 TestRenderFrameHost* main_render_frame_host() const {
318 return main_render_frame_host_;
319 }
320 void set_main_render_frame_host(TestRenderFrameHost* rfh) {
321 main_render_frame_host_ = rfh;
322 }
323
316 // RenderViewHost overrides -------------------------------------------------- 324 // RenderViewHost overrides --------------------------------------------------
317 325
318 virtual bool CreateRenderView(const base::string16& frame_name, 326 virtual bool CreateRenderView(const base::string16& frame_name,
319 int opener_route_id, 327 int opener_route_id,
320 int32 max_page_id) OVERRIDE; 328 int32 max_page_id) OVERRIDE;
321 virtual bool IsRenderViewLive() const OVERRIDE; 329 virtual bool IsRenderViewLive() const OVERRIDE;
322 330
323 private: 331 private:
324 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate); 332 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate);
325 333
(...skipping 25 matching lines...) Expand all
351 359
352 // See set_simulate_history_list_was_cleared() above. 360 // See set_simulate_history_list_was_cleared() above.
353 bool simulate_history_list_was_cleared_; 361 bool simulate_history_list_was_cleared_;
354 362
355 // See SetContentsMimeType() above. 363 // See SetContentsMimeType() above.
356 std::string contents_mime_type_; 364 std::string contents_mime_type_;
357 365
358 // See opener_route_id() above. 366 // See opener_route_id() above.
359 int opener_route_id_; 367 int opener_route_id_;
360 368
369 TestRenderFrameHost* main_render_frame_host_;
370
361 DISALLOW_COPY_AND_ASSIGN(TestRenderViewHost); 371 DISALLOW_COPY_AND_ASSIGN(TestRenderViewHost);
362 }; 372 };
363 373
364 #if defined(COMPILER_MSVC) 374 #if defined(COMPILER_MSVC)
365 #pragma warning(pop) 375 #pragma warning(pop)
366 #endif 376 #endif
367 377
368 // Adds methods to get straight at the impl classes. 378 // Adds methods to get straight at the impl classes.
369 class RenderViewHostImplTestHarness : public RenderViewHostTestHarness { 379 class RenderViewHostImplTestHarness : public RenderViewHostTestHarness {
370 public: 380 public:
371 RenderViewHostImplTestHarness(); 381 RenderViewHostImplTestHarness();
372 virtual ~RenderViewHostImplTestHarness(); 382 virtual ~RenderViewHostImplTestHarness();
373 383
374 TestRenderViewHost* test_rvh(); 384 TestRenderViewHost* test_rvh();
375 TestRenderViewHost* pending_test_rvh(); 385 TestRenderViewHost* pending_test_rvh();
376 TestRenderViewHost* active_test_rvh(); 386 TestRenderViewHost* active_test_rvh();
377 TestRenderFrameHost* main_test_rfh(); 387 TestRenderFrameHost* main_test_rfh();
378 TestWebContents* contents(); 388 TestWebContents* contents();
379 389
380 private: 390 private:
381 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> 391 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors>
382 ScopedSetSupportedScaleFactors; 392 ScopedSetSupportedScaleFactors;
383 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; 393 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_;
384 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); 394 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness);
385 }; 395 };
386 396
387 } // namespace content 397 } // namespace content
388 398
389 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ 399 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698