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

Side by Side Diff: content/test/test_renderer_host.cc

Issue 10073023: TabContents -> WebContentsImpl, part 14. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
« no previous file with comments | « content/test/test_renderer_host.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "content/test/test_renderer_host.h" 5 #include "content/test/test_renderer_host.h"
6 6
7 #include "content/browser/renderer_host/render_view_host_factory.h" 7 #include "content/browser/renderer_host/render_view_host_factory.h"
8 #include "content/browser/renderer_host/test_render_view_host.h" 8 #include "content/browser/renderer_host/test_render_view_host.h"
9 #include "content/browser/site_instance_impl.h" 9 #include "content/browser/site_instance_impl.h"
10 #include "content/browser/web_contents/navigation_entry_impl.h" 10 #include "content/browser/web_contents/navigation_entry_impl.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 void RenderViewHostTestHarness::SetContents(WebContents* contents) { 169 void RenderViewHostTestHarness::SetContents(WebContents* contents) {
170 contents_.reset(contents); 170 contents_.reset(contents);
171 } 171 }
172 172
173 WebContents* RenderViewHostTestHarness::CreateTestWebContents() { 173 WebContents* RenderViewHostTestHarness::CreateTestWebContents() {
174 // See comment above browser_context_ decl for why we check for NULL here. 174 // See comment above browser_context_ decl for why we check for NULL here.
175 if (!browser_context_.get()) 175 if (!browser_context_.get())
176 browser_context_.reset(new TestBrowserContext()); 176 browser_context_.reset(new TestBrowserContext());
177 177
178 // This will be deleted when the TabContents goes away. 178 // This will be deleted when the WebContentsImpl goes away.
179 SiteInstance* instance = SiteInstance::Create(browser_context_.get()); 179 SiteInstance* instance = SiteInstance::Create(browser_context_.get());
180 180
181 return new TestWebContents(browser_context_.get(), instance); 181 return new TestWebContents(browser_context_.get(), instance);
182 } 182 }
183 183
184 void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) { 184 void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) {
185 static_cast<TestWebContents*>(web_contents())->NavigateAndCommit(url); 185 static_cast<TestWebContents*>(web_contents())->NavigateAndCommit(url);
186 } 186 }
187 187
188 void RenderViewHostTestHarness::Reload() { 188 void RenderViewHostTestHarness::Reload() {
(...skipping 18 matching lines...) Expand all
207 SetContents(CreateTestWebContents()); 207 SetContents(CreateTestWebContents());
208 } 208 }
209 209
210 void RenderViewHostTestHarness::TearDown() { 210 void RenderViewHostTestHarness::TearDown() {
211 SetContents(NULL); 211 SetContents(NULL);
212 #if defined(USE_AURA) 212 #if defined(USE_AURA)
213 test_stacking_client_.reset(); 213 test_stacking_client_.reset();
214 root_window_.reset(); 214 root_window_.reset();
215 #endif 215 #endif
216 216
217 // Make sure that we flush any messages related to TabContents destruction 217 // Make sure that we flush any messages related to WebContentsImpl destruction
218 // before we destroy the browser context. 218 // before we destroy the browser context.
219 MessageLoop::current()->RunAllPending(); 219 MessageLoop::current()->RunAllPending();
220 220
221 // Release the browser context on the UI thread. 221 // Release the browser context on the UI thread.
222 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); 222 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release());
223 message_loop_.RunAllPending(); 223 message_loop_.RunAllPending();
224 } 224 }
225 225
226 void RenderViewHostTestHarness::SetRenderProcessHostFactory( 226 void RenderViewHostTestHarness::SetRenderProcessHostFactory(
227 RenderProcessHostFactory* factory) { 227 RenderProcessHostFactory* factory) {
228 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); 228 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory);
229 } 229 }
230 230
231 } // namespace content 231 } // namespace content
OLDNEW
« no previous file with comments | « content/test/test_renderer_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698