| 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/mock_content_browser_client.h" | 7 #include "content/browser/mock_content_browser_client.h" |
| 8 #include "content/browser/notification_service_impl.h" | 8 #include "content/browser/notification_service_impl.h" |
| 9 #include "content/public/common/content_client.h" | 9 #include "content/public/common/content_client.h" |
| 10 #include "content/public/test/mock_render_process_host.h" |
| 10 #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" |
| 11 | 13 |
| 12 namespace content { | 14 namespace content { |
| 13 | 15 |
| 14 TestContentClientInitializer::TestContentClientInitializer() { | 16 TestContentClientInitializer::TestContentClientInitializer() { |
| 15 notification_service_.reset(new NotificationServiceImpl()); | 17 notification_service_.reset(new NotificationServiceImpl()); |
| 16 | 18 |
| 17 DCHECK(!GetContentClient()); | 19 DCHECK(!GetContentClient()); |
| 18 content_client_.reset(new TestContentClient); | 20 content_client_.reset(new TestContentClient); |
| 19 SetContentClient(content_client_.get()); | 21 SetContentClient(content_client_.get()); |
| 20 | 22 |
| 21 content_browser_client_.reset(new MockContentBrowserClient()); | 23 content_browser_client_.reset(new MockContentBrowserClient()); |
| 22 content_client_->set_browser(content_browser_client_.get()); | 24 content_client_->set_browser(content_browser_client_.get()); |
| 23 } | 25 } |
| 24 | 26 |
| 25 TestContentClientInitializer::~TestContentClientInitializer() { | 27 TestContentClientInitializer::~TestContentClientInitializer() { |
| 28 test_render_view_host_factory_.reset(); |
| 29 rph_factory_.reset(); |
| 26 notification_service_.reset(); | 30 notification_service_.reset(); |
| 27 | 31 |
| 28 DCHECK_EQ(content_client_.get(), GetContentClient()); | 32 DCHECK_EQ(content_client_.get(), GetContentClient()); |
| 29 SetContentClient(NULL); | 33 SetContentClient(NULL); |
| 30 content_client_.reset(); | 34 content_client_.reset(); |
| 31 | 35 |
| 32 content_browser_client_.reset(); | 36 content_browser_client_.reset(); |
| 33 } | 37 } |
| 34 | 38 |
| 39 void TestContentClientInitializer::CreateTestRenderViewHosts() { |
| 40 rph_factory_.reset(new content::MockRenderProcessHostFactory()); |
| 41 test_render_view_host_factory_.reset( |
| 42 new content::TestRenderViewHostFactory(rph_factory_.get())); |
| 43 } |
| 44 |
| 35 } // namespace content | 45 } // namespace content |
| OLD | NEW |