| 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/test/content_test_suite.h" | 5 #include "content/test/content_test_suite.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/browser/mock_content_browser_client.h" | 9 #include "content/browser/mock_content_browser_client.h" |
| 10 #include "content/browser/notification_service_impl.h" | 10 #include "content/browser/notification_service_impl.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 class TestContentClientInitializer : public testing::EmptyTestEventListener { | 24 class TestContentClientInitializer : public testing::EmptyTestEventListener { |
| 25 public: | 25 public: |
| 26 TestContentClientInitializer() { | 26 TestContentClientInitializer() { |
| 27 } | 27 } |
| 28 | 28 |
| 29 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { | 29 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { |
| 30 notification_service_.reset(new NotificationServiceImpl()); | 30 notification_service_.reset(new NotificationServiceImpl()); |
| 31 | 31 |
| 32 DCHECK(!content::GetContentClient()); | 32 DCHECK(!content::GetContentClient()); |
| 33 content_client_.reset(new TestContentClient); | 33 content_client_.reset(new TestContentClient); |
| 34 content::SetContentClient(content_client_.get()); | 34 content::Initialize(content_client_.get(), "TestContentClient"); |
| 35 | 35 |
| 36 content_browser_client_.reset(new content::MockContentBrowserClient()); | 36 content_browser_client_.reset(new content::MockContentBrowserClient()); |
| 37 content_client_->set_browser(content_browser_client_.get()); | 37 content_client_->set_browser(content_browser_client_.get()); |
| 38 } | 38 } |
| 39 | 39 |
| 40 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { | 40 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { |
| 41 notification_service_.reset(); | 41 notification_service_.reset(); |
| 42 | 42 |
| 43 DCHECK_EQ(content_client_.get(), content::GetContentClient()); | 43 DCHECK_EQ(content_client_.get(), content::GetContentClient()); |
| 44 content::SetContentClient(NULL); | 44 content::Uninitialize(); |
| 45 content_client_.reset(); | 45 content_client_.reset(); |
| 46 | 46 |
| 47 content_browser_client_.reset(); | 47 content_browser_client_.reset(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 scoped_ptr<NotificationServiceImpl> notification_service_; | 51 scoped_ptr<NotificationServiceImpl> notification_service_; |
| 52 scoped_ptr<content::ContentClient> content_client_; | 52 scoped_ptr<content::ContentClient> content_client_; |
| 53 scoped_ptr<content::ContentBrowserClient> content_browser_client_; | 53 scoped_ptr<content::ContentBrowserClient> content_browser_client_; |
| 54 | 54 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 74 content::RegisterPathProvider(); | 74 content::RegisterPathProvider(); |
| 75 ui::RegisterPathProvider(); | 75 ui::RegisterPathProvider(); |
| 76 | 76 |
| 77 // Mock out the compositor on platforms that use it. | 77 // Mock out the compositor on platforms that use it. |
| 78 ui::SetupTestCompositor(); | 78 ui::SetupTestCompositor(); |
| 79 | 79 |
| 80 testing::TestEventListeners& listeners = | 80 testing::TestEventListeners& listeners = |
| 81 testing::UnitTest::GetInstance()->listeners(); | 81 testing::UnitTest::GetInstance()->listeners(); |
| 82 listeners.Append(new TestContentClientInitializer); | 82 listeners.Append(new TestContentClientInitializer); |
| 83 } | 83 } |
| 84 | |
| OLD | NEW |