| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 return TestWebContents::Create(browser_context_.get(), std::move(instance)); | 235 return TestWebContents::Create(browser_context_.get(), std::move(instance)); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) { | 238 void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) { |
| 239 static_cast<TestWebContents*>(web_contents())->NavigateAndCommit(url); | 239 static_cast<TestWebContents*>(web_contents())->NavigateAndCommit(url); |
| 240 } | 240 } |
| 241 | 241 |
| 242 void RenderViewHostTestHarness::Reload() { | 242 void RenderViewHostTestHarness::Reload() { |
| 243 NavigationEntry* entry = controller().GetLastCommittedEntry(); | 243 NavigationEntry* entry = controller().GetLastCommittedEntry(); |
| 244 DCHECK(entry); | 244 DCHECK(entry); |
| 245 controller().Reload(false); | 245 controller().Reload(ReloadType::NORMAL, false); |
| 246 RenderFrameHostTester::For(main_rfh()) | 246 RenderFrameHostTester::For(main_rfh()) |
| 247 ->SendNavigateWithTransition(entry->GetUniqueID(), | 247 ->SendNavigateWithTransition(entry->GetUniqueID(), |
| 248 false, entry->GetURL(), | 248 false, entry->GetURL(), |
| 249 ui::PAGE_TRANSITION_RELOAD); | 249 ui::PAGE_TRANSITION_RELOAD); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void RenderViewHostTestHarness::FailedReload() { | 252 void RenderViewHostTestHarness::FailedReload() { |
| 253 NavigationEntry* entry = controller().GetLastCommittedEntry(); | 253 NavigationEntry* entry = controller().GetLastCommittedEntry(); |
| 254 DCHECK(entry); | 254 DCHECK(entry); |
| 255 controller().Reload(false); | 255 controller().Reload(ReloadType::NORMAL, false); |
| 256 RenderFrameHostTester::For(main_rfh()) | 256 RenderFrameHostTester::For(main_rfh()) |
| 257 ->SendFailedNavigate(entry->GetUniqueID(), false, entry->GetURL()); | 257 ->SendFailedNavigate(entry->GetUniqueID(), false, entry->GetURL()); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void RenderViewHostTestHarness::SetUp() { | 260 void RenderViewHostTestHarness::SetUp() { |
| 261 // ContentTestSuiteBase might have already initialized | 261 // ContentTestSuiteBase might have already initialized |
| 262 // MaterialDesignController in unit_tests suite. | 262 // MaterialDesignController in unit_tests suite. |
| 263 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); | 263 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); |
| 264 ui::MaterialDesignController::Initialize(); | 264 ui::MaterialDesignController::Initialize(); |
| 265 thread_bundle_.reset(new TestBrowserThreadBundle(thread_bundle_options_)); | 265 thread_bundle_.reset(new TestBrowserThreadBundle(thread_bundle_options_)); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 333 |
| 334 void RenderViewHostTestHarness::SetRenderProcessHostFactory( | 334 void RenderViewHostTestHarness::SetRenderProcessHostFactory( |
| 335 RenderProcessHostFactory* factory) { | 335 RenderProcessHostFactory* factory) { |
| 336 if (rvh_test_enabler_) | 336 if (rvh_test_enabler_) |
| 337 rvh_test_enabler_->rvh_factory_->set_render_process_host_factory(factory); | 337 rvh_test_enabler_->rvh_factory_->set_render_process_host_factory(factory); |
| 338 else | 338 else |
| 339 factory_ = factory; | 339 factory_ = factory; |
| 340 } | 340 } |
| 341 | 341 |
| 342 } // namespace content | 342 } // namespace content |
| OLD | NEW |