Chromium Code Reviews| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 return TestWebContents::Create(browser_context_.get(), std::move(instance)); | 205 return TestWebContents::Create(browser_context_.get(), std::move(instance)); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) { | 208 void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) { |
| 209 static_cast<TestWebContents*>(web_contents())->NavigateAndCommit(url); | 209 static_cast<TestWebContents*>(web_contents())->NavigateAndCommit(url); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void RenderViewHostTestHarness::Reload() { | 212 void RenderViewHostTestHarness::Reload() { |
| 213 NavigationEntry* entry = controller().GetLastCommittedEntry(); | 213 NavigationEntry* entry = controller().GetLastCommittedEntry(); |
| 214 DCHECK(entry); | 214 DCHECK(entry); |
| 215 controller().Reload(false); | 215 controller().Reload(ReloadType::NORMAL, false); |
|
Takashi Toyoshima
2016/12/15 06:21:52
for testing
| |
| 216 RenderFrameHostTester::For(main_rfh()) | 216 RenderFrameHostTester::For(main_rfh()) |
| 217 ->SendNavigateWithTransition(entry->GetUniqueID(), | 217 ->SendNavigateWithTransition(entry->GetUniqueID(), |
| 218 false, entry->GetURL(), | 218 false, entry->GetURL(), |
| 219 ui::PAGE_TRANSITION_RELOAD); | 219 ui::PAGE_TRANSITION_RELOAD); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void RenderViewHostTestHarness::FailedReload() { | 222 void RenderViewHostTestHarness::FailedReload() { |
| 223 NavigationEntry* entry = controller().GetLastCommittedEntry(); | 223 NavigationEntry* entry = controller().GetLastCommittedEntry(); |
| 224 DCHECK(entry); | 224 DCHECK(entry); |
| 225 controller().Reload(false); | 225 controller().Reload(ReloadType::NORMAL, false); |
|
Takashi Toyoshima
2016/12/15 06:21:52
ditto
| |
| 226 RenderFrameHostTester::For(main_rfh()) | 226 RenderFrameHostTester::For(main_rfh()) |
| 227 ->SendFailedNavigate(entry->GetUniqueID(), false, entry->GetURL()); | 227 ->SendFailedNavigate(entry->GetUniqueID(), false, entry->GetURL()); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void RenderViewHostTestHarness::SetUp() { | 230 void RenderViewHostTestHarness::SetUp() { |
| 231 // ContentTestSuiteBase might have already initialized | 231 // ContentTestSuiteBase might have already initialized |
| 232 // MaterialDesignController in unit_tests suite. | 232 // MaterialDesignController in unit_tests suite. |
| 233 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); | 233 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); |
| 234 ui::MaterialDesignController::Initialize(); | 234 ui::MaterialDesignController::Initialize(); |
| 235 thread_bundle_.reset(new TestBrowserThreadBundle(thread_bundle_options_)); | 235 thread_bundle_.reset(new TestBrowserThreadBundle(thread_bundle_options_)); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { | 323 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { |
| 324 return new TestBrowserContext(); | 324 return new TestBrowserContext(); |
| 325 } | 325 } |
| 326 | 326 |
| 327 void RenderViewHostTestHarness::SetRenderProcessHostFactory( | 327 void RenderViewHostTestHarness::SetRenderProcessHostFactory( |
| 328 RenderProcessHostFactory* factory) { | 328 RenderProcessHostFactory* factory) { |
| 329 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); | 329 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); |
| 330 } | 330 } |
| 331 | 331 |
| 332 } // namespace content | 332 } // namespace content |
| OLD | NEW |