| 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 #include "content/public/test/test_renderer_host.h" | 5 #include "content/public/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/render_widget_host_impl.h" | 8 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 9 #include "content/browser/renderer_host/test_render_view_host.h" | 9 #include "content/browser/renderer_host/test_render_view_host.h" |
| 10 #include "content/browser/site_instance_impl.h" | 10 #include "content/browser/site_instance_impl.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 111 } |
| 112 | 112 |
| 113 WebContents* RenderViewHostTestHarness::CreateTestWebContents() { | 113 WebContents* RenderViewHostTestHarness::CreateTestWebContents() { |
| 114 // See comment above browser_context_ decl for why we check for NULL here. | 114 // See comment above browser_context_ decl for why we check for NULL here. |
| 115 if (!browser_context_.get()) | 115 if (!browser_context_.get()) |
| 116 browser_context_.reset(new content::TestBrowserContext()); | 116 browser_context_.reset(new content::TestBrowserContext()); |
| 117 | 117 |
| 118 // This will be deleted when the WebContentsImpl goes away. | 118 // This will be deleted when the WebContentsImpl goes away. |
| 119 SiteInstance* instance = SiteInstance::Create(browser_context_.get()); | 119 SiteInstance* instance = SiteInstance::Create(browser_context_.get()); |
| 120 | 120 |
| 121 return new TestWebContents(browser_context_.get(), instance); | 121 return TestWebContents::Create(browser_context_.get(), instance); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) { | 124 void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) { |
| 125 static_cast<TestWebContents*>(web_contents())->NavigateAndCommit(url); | 125 static_cast<TestWebContents*>(web_contents())->NavigateAndCommit(url); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void RenderViewHostTestHarness::Reload() { | 128 void RenderViewHostTestHarness::Reload() { |
| 129 NavigationEntry* entry = controller().GetLastCommittedEntry(); | 129 NavigationEntry* entry = controller().GetLastCommittedEntry(); |
| 130 DCHECK(entry); | 130 DCHECK(entry); |
| 131 controller().Reload(false); | 131 controller().Reload(false); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 158 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); | 158 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); |
| 159 message_loop_.RunAllPending(); | 159 message_loop_.RunAllPending(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void RenderViewHostTestHarness::SetRenderProcessHostFactory( | 162 void RenderViewHostTestHarness::SetRenderProcessHostFactory( |
| 163 RenderProcessHostFactory* factory) { | 163 RenderProcessHostFactory* factory) { |
| 164 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); | 164 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace content | 167 } // namespace content |
| OLD | NEW |