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

Side by Side Diff: chrome/browser/renderer_host/test_render_view_host.cc

Issue 18432: Factor out the test web contents from the WebContents unit test so that it ca... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 months 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "chrome/browser/renderer_host/test_render_view_host.h" 5 #include "chrome/browser/renderer_host/test_render_view_host.h"
6 #include "chrome/browser/tab_contents/test_web_contents.h"
6 7
7 TestRenderViewHost::TestRenderViewHost(SiteInstance* instance, 8 TestRenderViewHost::TestRenderViewHost(SiteInstance* instance,
8 RenderViewHostDelegate* delegate, 9 RenderViewHostDelegate* delegate,
9 int routing_id, 10 int routing_id,
10 base::WaitableEvent* modal_dialog_event) 11 base::WaitableEvent* modal_dialog_event)
11 : RenderViewHost(instance, delegate, routing_id, modal_dialog_event), 12 : RenderViewHost(instance, delegate, routing_id, modal_dialog_event),
12 render_view_created_(false), 13 render_view_created_(false),
13 delete_counter_(NULL) { 14 delete_counter_(NULL) {
14 set_view(new TestRenderWidgetHostView()); 15 set_view(new TestRenderWidgetHostView());
15 } 16 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 params.gesture = NavigationGestureUser; 54 params.gesture = NavigationGestureUser;
54 params.contents_mime_type = std::string(); 55 params.contents_mime_type = std::string();
55 params.is_post = false; 56 params.is_post = false;
56 params.is_content_filtered = false; 57 params.is_content_filtered = false;
57 58
58 ViewHostMsg_FrameNavigate msg(1, params); 59 ViewHostMsg_FrameNavigate msg(1, params);
59 OnMsgNavigate(msg); 60 OnMsgNavigate(msg);
60 } 61 }
61 62
62 void RenderViewHostTestHarness::SetUp() { 63 void RenderViewHostTestHarness::SetUp() {
64 // See comment above profile_ decl for why we check for NULL here.
65 if (!profile_.get())
66 profile_.reset(new TestingProfile());
67
63 // This will be deleted when the WebContents goes away. 68 // This will be deleted when the WebContents goes away.
64 SiteInstance* instance = SiteInstance::CreateSiteInstance(&profile_); 69 SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get());
65 70
66 // Make the SiteInstance use our RenderProcessHost as its own. 71 contents_ = new TestWebContents(profile_.get(), instance, &rvh_factory_);
67 process_ = new MockRenderProcessHost(&profile_); 72 controller_ = new NavigationController(contents_, profile_.get());
68 instance->set_process_host_id(process_->host_id());
69
70 contents_ = new WebContents(&profile_, instance, &rvh_factory_, 12, NULL);
71 controller_ = new NavigationController(contents_, &profile_);
72 } 73 }
73 74
74 void RenderViewHostTestHarness::TearDown() { 75 void RenderViewHostTestHarness::TearDown() {
75 contents_->CloseContents(); 76 contents_->CloseContents();
76 contents_ = NULL; 77 contents_ = NULL;
77 controller_ = NULL; 78 controller_ = NULL;
78 79
79 // Make sure that we flush any messages related to WebContents destruction 80 // Make sure that we flush any messages related to WebContents destruction
80 // before we destroy the profile. 81 // before we destroy the profile.
81 MessageLoop::current()->RunAllPending(); 82 MessageLoop::current()->RunAllPending();
82 } 83 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/test_render_view_host.h ('k') | chrome/browser/tab_contents/site_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698