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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/metrics/statistics_recorder.h" | 8 #include "base/metrics/statistics_recorder.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/test/launcher/unit_test_launcher.h" | 10 #include "base/test/launcher/unit_test_launcher.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 base::TestSuite::Shutdown(); | 82 base::TestSuite::Shutdown(); |
83 } | 83 } |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(ComponentsTestSuite); | 85 DISALLOW_COPY_AND_ASSIGN(ComponentsTestSuite); |
86 }; | 86 }; |
87 | 87 |
88 class ComponentsUnitTestEventListener : public testing::EmptyTestEventListener { | 88 class ComponentsUnitTestEventListener : public testing::EmptyTestEventListener { |
89 public: | 89 public: |
90 ComponentsUnitTestEventListener() {} | 90 ComponentsUnitTestEventListener() {} |
91 virtual ~ComponentsUnitTestEventListener() {} | 91 ~ComponentsUnitTestEventListener() override {} |
92 | 92 |
93 virtual void OnTestStart(const testing::TestInfo& test_info) override { | 93 void OnTestStart(const testing::TestInfo& test_info) override { |
94 content_initializer_.reset(new content::TestContentClientInitializer()); | 94 content_initializer_.reset(new content::TestContentClientInitializer()); |
95 } | 95 } |
96 | 96 |
97 virtual void OnTestEnd(const testing::TestInfo& test_info) override { | 97 void OnTestEnd(const testing::TestInfo& test_info) override { |
98 content_initializer_.reset(); | 98 content_initializer_.reset(); |
99 } | 99 } |
100 | 100 |
101 private: | 101 private: |
102 scoped_ptr<content::TestContentClientInitializer> content_initializer_; | 102 scoped_ptr<content::TestContentClientInitializer> content_initializer_; |
103 | 103 |
104 DISALLOW_COPY_AND_ASSIGN(ComponentsUnitTestEventListener); | 104 DISALLOW_COPY_AND_ASSIGN(ComponentsUnitTestEventListener); |
105 }; | 105 }; |
106 | 106 |
107 } // namespace | 107 } // namespace |
108 | 108 |
109 int main(int argc, char** argv) { | 109 int main(int argc, char** argv) { |
110 ComponentsTestSuite test_suite(argc, argv); | 110 ComponentsTestSuite test_suite(argc, argv); |
111 | 111 |
112 // The listener will set up common test environment for all components unit | 112 // The listener will set up common test environment for all components unit |
113 // tests. | 113 // tests. |
114 testing::TestEventListeners& listeners = | 114 testing::TestEventListeners& listeners = |
115 testing::UnitTest::GetInstance()->listeners(); | 115 testing::UnitTest::GetInstance()->listeners(); |
116 listeners.Append(new ComponentsUnitTestEventListener()); | 116 listeners.Append(new ComponentsUnitTestEventListener()); |
117 | 117 |
118 return base::LaunchUnitTests( | 118 return base::LaunchUnitTests( |
119 argc, argv, base::Bind(&base::TestSuite::Run, | 119 argc, argv, base::Bind(&base::TestSuite::Run, |
120 base::Unretained(&test_suite))); | 120 base::Unretained(&test_suite))); |
121 } | 121 } |
OLD | NEW |