| 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/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" |
| 11 #include "content/browser/web_contents/test_web_contents.h" | 11 #include "content/browser/web_contents/test_web_contents.h" |
| 12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 #include "content/public/test/mock_render_process_host.h" | 13 #include "content/public/test/mock_render_process_host.h" |
| 14 #include "content/test/test_browser_context.h" | 14 #include "content/public/test/test_browser_context.h" |
| 15 #include "content/test/test_render_view_host_factory.h" | 15 #include "content/test/test_render_view_host_factory.h" |
| 16 | 16 |
| 17 #if defined(USE_AURA) | 17 #if defined(USE_AURA) |
| 18 #include "ui/aura/test/aura_test_helper.h" | 18 #include "ui/aura/test/aura_test_helper.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 RenderViewHostTester* RenderViewHostTester::For(RenderViewHost* host) { | 24 RenderViewHostTester* RenderViewHostTester::For(RenderViewHost* host) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 SetContents(NULL); | 99 SetContents(NULL); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void RenderViewHostTestHarness::SetContents(WebContents* contents) { | 102 void RenderViewHostTestHarness::SetContents(WebContents* contents) { |
| 103 contents_.reset(contents); | 103 contents_.reset(contents); |
| 104 } | 104 } |
| 105 | 105 |
| 106 WebContents* RenderViewHostTestHarness::CreateTestWebContents() { | 106 WebContents* RenderViewHostTestHarness::CreateTestWebContents() { |
| 107 // See comment above browser_context_ decl for why we check for NULL here. | 107 // See comment above browser_context_ decl for why we check for NULL here. |
| 108 if (!browser_context_.get()) | 108 if (!browser_context_.get()) |
| 109 browser_context_.reset(new TestBrowserContext()); | 109 browser_context_.reset(new content::TestBrowserContext()); |
| 110 | 110 |
| 111 // This will be deleted when the WebContentsImpl goes away. | 111 // This will be deleted when the WebContentsImpl goes away. |
| 112 SiteInstance* instance = SiteInstance::Create(browser_context_.get()); | 112 SiteInstance* instance = SiteInstance::Create(browser_context_.get()); |
| 113 | 113 |
| 114 return new TestWebContents(browser_context_.get(), instance); | 114 return new TestWebContents(browser_context_.get(), instance); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) { | 117 void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) { |
| 118 static_cast<TestWebContents*>(web_contents())->NavigateAndCommit(url); | 118 static_cast<TestWebContents*>(web_contents())->NavigateAndCommit(url); |
| 119 } | 119 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 147 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); | 147 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); |
| 148 message_loop_.RunAllPending(); | 148 message_loop_.RunAllPending(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void RenderViewHostTestHarness::SetRenderProcessHostFactory( | 151 void RenderViewHostTestHarness::SetRenderProcessHostFactory( |
| 152 RenderProcessHostFactory* factory) { | 152 RenderProcessHostFactory* factory) { |
| 153 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); | 153 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace content | 156 } // namespace content |
| OLD | NEW |