OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/test_render_view_host.h" | 5 #include "chrome/browser/renderer_host/test/test_render_view_host.h" |
6 | 6 |
7 #include "chrome/browser/browser_url_handler.h" | 7 #include "chrome/browser/browser_url_handler.h" |
8 #include "chrome/browser/renderer_host/site_instance.h" | 8 #include "chrome/browser/renderer_host/site_instance.h" |
9 #include "chrome/browser/renderer_host/test/test_backing_store.h" | 9 #include "chrome/browser/renderer_host/test/test_backing_store.h" |
10 #include "chrome/browser/tab_contents/navigation_controller.h" | 10 #include "chrome/browser/tab_contents/navigation_controller.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 229 |
230 TestRenderViewHost* RenderViewHostTestHarness::active_rvh() { | 230 TestRenderViewHost* RenderViewHostTestHarness::active_rvh() { |
231 return pending_rvh() ? pending_rvh() : rvh(); | 231 return pending_rvh() ? pending_rvh() : rvh(); |
232 } | 232 } |
233 | 233 |
234 TestingProfile* RenderViewHostTestHarness::profile() { | 234 TestingProfile* RenderViewHostTestHarness::profile() { |
235 return profile_.get(); | 235 return profile_.get(); |
236 } | 236 } |
237 | 237 |
238 MockRenderProcessHost* RenderViewHostTestHarness::process() { | 238 MockRenderProcessHost* RenderViewHostTestHarness::process() { |
239 if (pending_rvh()) | |
240 return static_cast<MockRenderProcessHost*>(pending_rvh()->process()); | |
241 return static_cast<MockRenderProcessHost*>(rvh()->process()); | 239 return static_cast<MockRenderProcessHost*>(rvh()->process()); |
242 } | 240 } |
243 | 241 |
244 void RenderViewHostTestHarness::DeleteContents() { | 242 void RenderViewHostTestHarness::DeleteContents() { |
245 contents_.reset(); | 243 contents_.reset(); |
246 } | 244 } |
247 | 245 |
248 TestTabContents* RenderViewHostTestHarness::CreateTestTabContents() { | 246 TestTabContents* RenderViewHostTestHarness::CreateTestTabContents() { |
249 // See comment above profile_ decl for why we check for NULL here. | 247 // See comment above profile_ decl for why we check for NULL here. |
250 if (!profile_.get()) | 248 if (!profile_.get()) |
(...skipping 24 matching lines...) Expand all Loading... |
275 contents_.reset(); | 273 contents_.reset(); |
276 | 274 |
277 // Make sure that we flush any messages related to TabContents destruction | 275 // Make sure that we flush any messages related to TabContents destruction |
278 // before we destroy the profile. | 276 // before we destroy the profile. |
279 MessageLoop::current()->RunAllPending(); | 277 MessageLoop::current()->RunAllPending(); |
280 | 278 |
281 // Release the profile on the UI thread. | 279 // Release the profile on the UI thread. |
282 message_loop_.DeleteSoon(FROM_HERE, profile_.release()); | 280 message_loop_.DeleteSoon(FROM_HERE, profile_.release()); |
283 message_loop_.RunAllPending(); | 281 message_loop_.RunAllPending(); |
284 } | 282 } |
OLD | NEW |