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 "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "content/browser/frame_host/navigation_entry_impl.h" | 11 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 12 #include "content/browser/renderer_host/render_view_host_factory.h" | 12 #include "content/browser/renderer_host/render_view_host_factory.h" |
| 13 #include "content/browser/renderer_host/render_widget_host_impl.h" | 13 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 14 #include "content/browser/site_instance_impl.h" | 14 #include "content/browser/site_instance_impl.h" |
| 15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 #include "content/public/common/browser_side_navigation_policy.h" | 17 #include "content/public/common/browser_side_navigation_policy.h" |
| 18 #include "content/public/test/mock_render_process_host.h" | 18 #include "content/public/test/mock_render_process_host.h" |
| 19 #include "content/public/test/test_browser_context.h" | 19 #include "content/public/test/test_browser_context.h" |
| 20 #include "content/test/browser_side_navigation_test_utils.h" | 20 #include "content/test/browser_side_navigation_test_utils.h" |
| 21 #include "content/test/content_browser_sanity_checker.h" | 21 #include "content/test/content_browser_sanity_checker.h" |
| 22 #include "content/test/test_render_frame_host.h" | 22 #include "content/test/test_render_frame_host.h" |
| 23 #include "content/test/test_render_frame_host_factory.h" | 23 #include "content/test/test_render_frame_host_factory.h" |
| 24 #include "content/test/test_render_view_host.h" | 24 #include "content/test/test_render_view_host.h" |
| 25 #include "content/test/test_render_view_host_factory.h" | 25 #include "content/test/test_render_view_host_factory.h" |
| 26 #include "content/test/test_web_contents.h" | 26 #include "content/test/test_web_contents.h" |
| 27 #include "ui/base/material_design/material_design_controller.h" | |
| 28 #include "ui/base/test/material_design_controller_test_api.h" | |
| 27 | 29 |
| 28 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
| 29 #include "ui/base/win/scoped_ole_initializer.h" | 31 #include "ui/base/win/scoped_ole_initializer.h" |
| 30 #endif | 32 #endif |
| 31 | 33 |
| 32 #if defined(USE_AURA) | 34 #if defined(USE_AURA) |
| 33 #include "ui/aura/test/aura_test_helper.h" | 35 #include "ui/aura/test/aura_test_helper.h" |
| 34 #include "ui/compositor/test/context_factories_for_test.h" | 36 #include "ui/compositor/test/context_factories_for_test.h" |
| 35 #include "ui/wm/core/default_activation_client.h" | 37 #include "ui/wm/core/default_activation_client.h" |
| 36 #endif | 38 #endif |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 void RenderViewHostTestHarness::FailedReload() { | 174 void RenderViewHostTestHarness::FailedReload() { |
| 173 NavigationEntry* entry = controller().GetLastCommittedEntry(); | 175 NavigationEntry* entry = controller().GetLastCommittedEntry(); |
| 174 DCHECK(entry); | 176 DCHECK(entry); |
| 175 controller().Reload(false); | 177 controller().Reload(false); |
| 176 RenderFrameHostTester::For(main_rfh()) | 178 RenderFrameHostTester::For(main_rfh()) |
| 177 ->SendFailedNavigate(entry->GetPageID(), entry->GetUniqueID(), false, | 179 ->SendFailedNavigate(entry->GetPageID(), entry->GetUniqueID(), false, |
| 178 entry->GetURL()); | 180 entry->GetURL()); |
| 179 } | 181 } |
| 180 | 182 |
| 181 void RenderViewHostTestHarness::SetUp() { | 183 void RenderViewHostTestHarness::SetUp() { |
| 184 // ContentTestSuiteBase might have already initialized | |
|
sky
2016/04/11 15:32:40
Similar comment here.
| |
| 185 // MaterialDesignController in unit_tests suite. | |
| 186 ui::test::MaterialDesignControllerTestAPI::UninitializeMode(); | |
| 187 ui::MaterialDesignController::Initialize(); | |
| 182 thread_bundle_.reset(new TestBrowserThreadBundle(thread_bundle_options_)); | 188 thread_bundle_.reset(new TestBrowserThreadBundle(thread_bundle_options_)); |
| 183 | 189 |
| 184 #if defined(OS_WIN) | 190 #if defined(OS_WIN) |
| 185 ole_initializer_.reset(new ui::ScopedOleInitializer()); | 191 ole_initializer_.reset(new ui::ScopedOleInitializer()); |
| 186 #endif | 192 #endif |
| 187 #if defined(USE_AURA) | 193 #if defined(USE_AURA) |
| 188 // The ContextFactory must exist before any Compositors are created. | 194 // The ContextFactory must exist before any Compositors are created. |
| 189 bool enable_pixel_output = false; | 195 bool enable_pixel_output = false; |
| 190 ui::ContextFactory* context_factory = | 196 ui::ContextFactory* context_factory = |
| 191 ui::InitializeContextFactoryForTests(enable_pixel_output); | 197 ui::InitializeContextFactoryForTests(enable_pixel_output); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { | 247 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { |
| 242 return new TestBrowserContext(); | 248 return new TestBrowserContext(); |
| 243 } | 249 } |
| 244 | 250 |
| 245 void RenderViewHostTestHarness::SetRenderProcessHostFactory( | 251 void RenderViewHostTestHarness::SetRenderProcessHostFactory( |
| 246 RenderProcessHostFactory* factory) { | 252 RenderProcessHostFactory* factory) { |
| 247 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); | 253 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); |
| 248 } | 254 } |
| 249 | 255 |
| 250 } // namespace content | 256 } // namespace content |
| OLD | NEW |