| 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_content_client_initializer.h" | 5 #include "content/public/test/test_content_client_initializer.h" |
| 6 | 6 |
| 7 #include "content/browser/notification_service_impl.h" | 7 #include "content/browser/notification_service_impl.h" |
| 8 #include "content/public/common/content_client.h" | 8 #include "content/public/common/content_client.h" |
| 9 #include "content/public/test/mock_render_process_host.h" | 9 #include "content/public/test/mock_render_process_host.h" |
| 10 #include "content/test/test_content_browser_client.h" | 10 #include "content/test/test_content_browser_client.h" |
| 11 #include "content/test/test_content_client.h" | 11 #include "content/test/test_content_client.h" |
| 12 #include "content/test/test_render_view_host_factory.h" | 12 #include "content/test/test_render_view_host_factory.h" |
| 13 #include "ui/base/ui_base_paths.h" | |
| 14 | 13 |
| 15 namespace content { | 14 namespace content { |
| 16 | 15 |
| 17 TestContentClientInitializer::TestContentClientInitializer() { | 16 TestContentClientInitializer::TestContentClientInitializer() { |
| 18 // The TestContentClient uses content_shell.pak, so ensure the paths are set. | |
| 19 ui::RegisterPathProvider(); | |
| 20 | |
| 21 notification_service_.reset(new NotificationServiceImpl()); | 17 notification_service_.reset(new NotificationServiceImpl()); |
| 22 | 18 |
| 23 content_client_.reset(new TestContentClient); | 19 content_client_.reset(new TestContentClient); |
| 24 SetContentClient(content_client_.get()); | 20 SetContentClient(content_client_.get()); |
| 25 | 21 |
| 26 content_browser_client_.reset(new TestContentBrowserClient()); | 22 content_browser_client_.reset(new TestContentBrowserClient()); |
| 27 content::SetBrowserClientForTesting(content_browser_client_.get()); | 23 content::SetBrowserClientForTesting(content_browser_client_.get()); |
| 28 } | 24 } |
| 29 | 25 |
| 30 TestContentClientInitializer::~TestContentClientInitializer() { | 26 TestContentClientInitializer::~TestContentClientInitializer() { |
| 31 test_render_view_host_factory_.reset(); | 27 test_render_view_host_factory_.reset(); |
| 32 rph_factory_.reset(); | 28 rph_factory_.reset(); |
| 33 notification_service_.reset(); | 29 notification_service_.reset(); |
| 34 | 30 |
| 35 SetContentClient(NULL); | 31 SetContentClient(NULL); |
| 36 content_client_.reset(); | 32 content_client_.reset(); |
| 37 | 33 |
| 38 content_browser_client_.reset(); | 34 content_browser_client_.reset(); |
| 39 } | 35 } |
| 40 | 36 |
| 41 void TestContentClientInitializer::CreateTestRenderViewHosts() { | 37 void TestContentClientInitializer::CreateTestRenderViewHosts() { |
| 42 #if !defined(OS_IOS) | 38 #if !defined(OS_IOS) |
| 43 rph_factory_.reset(new MockRenderProcessHostFactory()); | 39 rph_factory_.reset(new MockRenderProcessHostFactory()); |
| 44 test_render_view_host_factory_.reset( | 40 test_render_view_host_factory_.reset( |
| 45 new TestRenderViewHostFactory(rph_factory_.get())); | 41 new TestRenderViewHostFactory(rph_factory_.get())); |
| 46 #endif // OS_IOS | 42 #endif // OS_IOS |
| 47 } | 43 } |
| 48 | 44 |
| 49 } // namespace content | 45 } // namespace content |
| OLD | NEW |