| 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" | |
| 29 | 27 |
| 30 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
| 31 #include "ui/base/win/scoped_ole_initializer.h" | 29 #include "ui/base/win/scoped_ole_initializer.h" |
| 32 #endif | 30 #endif |
| 33 | 31 |
| 34 #if defined(USE_AURA) | 32 #if defined(USE_AURA) |
| 35 #include "ui/aura/test/aura_test_helper.h" | 33 #include "ui/aura/test/aura_test_helper.h" |
| 36 #include "ui/compositor/test/context_factories_for_test.h" | 34 #include "ui/compositor/test/context_factories_for_test.h" |
| 37 #include "ui/wm/core/default_activation_client.h" | 35 #include "ui/wm/core/default_activation_client.h" |
| 38 #endif | 36 #endif |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 void RenderViewHostTestHarness::FailedReload() { | 172 void RenderViewHostTestHarness::FailedReload() { |
| 175 NavigationEntry* entry = controller().GetLastCommittedEntry(); | 173 NavigationEntry* entry = controller().GetLastCommittedEntry(); |
| 176 DCHECK(entry); | 174 DCHECK(entry); |
| 177 controller().Reload(false); | 175 controller().Reload(false); |
| 178 RenderFrameHostTester::For(main_rfh()) | 176 RenderFrameHostTester::For(main_rfh()) |
| 179 ->SendFailedNavigate(entry->GetPageID(), entry->GetUniqueID(), false, | 177 ->SendFailedNavigate(entry->GetPageID(), entry->GetUniqueID(), false, |
| 180 entry->GetURL()); | 178 entry->GetURL()); |
| 181 } | 179 } |
| 182 | 180 |
| 183 void RenderViewHostTestHarness::SetUp() { | 181 void RenderViewHostTestHarness::SetUp() { |
| 184 // ContentTestSuiteBase might have already initialized | |
| 185 // MaterialDesignController in unit_tests suite. | |
| 186 ui::test::MaterialDesignControllerTestAPI::UninitializeMode(); | |
| 187 ui::MaterialDesignController::Initialize(); | |
| 188 thread_bundle_.reset(new TestBrowserThreadBundle(thread_bundle_options_)); | 182 thread_bundle_.reset(new TestBrowserThreadBundle(thread_bundle_options_)); |
| 189 | 183 |
| 190 #if defined(OS_WIN) | 184 #if defined(OS_WIN) |
| 191 ole_initializer_.reset(new ui::ScopedOleInitializer()); | 185 ole_initializer_.reset(new ui::ScopedOleInitializer()); |
| 192 #endif | 186 #endif |
| 193 #if defined(USE_AURA) | 187 #if defined(USE_AURA) |
| 194 // The ContextFactory must exist before any Compositors are created. | 188 // The ContextFactory must exist before any Compositors are created. |
| 195 bool enable_pixel_output = false; | 189 bool enable_pixel_output = false; |
| 196 ui::ContextFactory* context_factory = | 190 ui::ContextFactory* context_factory = |
| 197 ui::InitializeContextFactoryForTests(enable_pixel_output); | 191 ui::InitializeContextFactoryForTests(enable_pixel_output); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { | 241 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { |
| 248 return new TestBrowserContext(); | 242 return new TestBrowserContext(); |
| 249 } | 243 } |
| 250 | 244 |
| 251 void RenderViewHostTestHarness::SetRenderProcessHostFactory( | 245 void RenderViewHostTestHarness::SetRenderProcessHostFactory( |
| 252 RenderProcessHostFactory* factory) { | 246 RenderProcessHostFactory* factory) { |
| 253 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); | 247 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); |
| 254 } | 248 } |
| 255 | 249 |
| 256 } // namespace content | 250 } // namespace content |
| OLD | NEW |