| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "content/browser/frame_host/navigation_entry_impl.h" | 9 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 10 #include "content/browser/renderer_host/render_view_host_factory.h" | 10 #include "content/browser/renderer_host/render_view_host_factory.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 156 } |
| 157 | 157 |
| 158 void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) { | 158 void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) { |
| 159 static_cast<TestWebContents*>(web_contents())->NavigateAndCommit(url); | 159 static_cast<TestWebContents*>(web_contents())->NavigateAndCommit(url); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void RenderViewHostTestHarness::Reload() { | 162 void RenderViewHostTestHarness::Reload() { |
| 163 NavigationEntry* entry = controller().GetLastCommittedEntry(); | 163 NavigationEntry* entry = controller().GetLastCommittedEntry(); |
| 164 DCHECK(entry); | 164 DCHECK(entry); |
| 165 controller().Reload(false); | 165 controller().Reload(false); |
| 166 RenderFrameHostTester::For(main_rfh()) | 166 RenderFrameHostTester::For(main_rfh())->SendNavigateWithTransition( |
| 167 ->SendNavigateWithTransition(entry->GetPageID(), entry->GetUniqueID(), | 167 entry->GetPageID(), entry->GetURL(), ui::PAGE_TRANSITION_RELOAD); |
| 168 false, entry->GetURL(), | |
| 169 ui::PAGE_TRANSITION_RELOAD); | |
| 170 } | 168 } |
| 171 | 169 |
| 172 void RenderViewHostTestHarness::FailedReload() { | 170 void RenderViewHostTestHarness::FailedReload() { |
| 173 NavigationEntry* entry = controller().GetLastCommittedEntry(); | 171 NavigationEntry* entry = controller().GetLastCommittedEntry(); |
| 174 DCHECK(entry); | 172 DCHECK(entry); |
| 175 controller().Reload(false); | 173 controller().Reload(false); |
| 176 RenderFrameHostTester::For(main_rfh()) | 174 RenderFrameHostTester::For(main_rfh())->SendFailedNavigate(entry->GetPageID(), |
| 177 ->SendFailedNavigate(entry->GetPageID(), entry->GetUniqueID(), false, | 175 entry->GetURL()); |
| 178 entry->GetURL()); | |
| 179 } | 176 } |
| 180 | 177 |
| 181 void RenderViewHostTestHarness::SetUp() { | 178 void RenderViewHostTestHarness::SetUp() { |
| 182 thread_bundle_.reset(new TestBrowserThreadBundle(thread_bundle_options_)); | 179 thread_bundle_.reset(new TestBrowserThreadBundle(thread_bundle_options_)); |
| 183 | 180 |
| 184 #if defined(OS_WIN) | 181 #if defined(OS_WIN) |
| 185 ole_initializer_.reset(new ui::ScopedOleInitializer()); | 182 ole_initializer_.reset(new ui::ScopedOleInitializer()); |
| 186 #endif | 183 #endif |
| 187 #if defined(USE_AURA) | 184 #if defined(USE_AURA) |
| 188 // The ContextFactory must exist before any Compositors are created. | 185 // The ContextFactory must exist before any Compositors are created. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { | 242 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { |
| 246 return new TestBrowserContext(); | 243 return new TestBrowserContext(); |
| 247 } | 244 } |
| 248 | 245 |
| 249 void RenderViewHostTestHarness::SetRenderProcessHostFactory( | 246 void RenderViewHostTestHarness::SetRenderProcessHostFactory( |
| 250 RenderProcessHostFactory* factory) { | 247 RenderProcessHostFactory* factory) { |
| 251 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); | 248 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); |
| 252 } | 249 } |
| 253 | 250 |
| 254 } // namespace content | 251 } // namespace content |
| OLD | NEW |