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 "components/test/components_test_suite.h" |
| 6 |
5 #include <memory> | 7 #include <memory> |
6 | 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ptr_util.h" |
11 #include "base/metrics/statistics_recorder.h" | 14 #include "base/metrics/statistics_recorder.h" |
12 #include "base/path_service.h" | 15 #include "base/path_service.h" |
13 #include "base/test/launcher/unit_test_launcher.h" | 16 #include "base/test/launcher/unit_test_launcher.h" |
14 #include "base/test/test_suite.h" | 17 #include "base/test/test_suite.h" |
15 #include "build/build_config.h" | 18 #include "build/build_config.h" |
16 #include "components/content_settings/core/common/content_settings_pattern.h" | 19 #include "components/content_settings/core/common/content_settings_pattern.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
19 #include "ui/base/ui_base_paths.h" | 22 #include "ui/base/ui_base_paths.h" |
20 #include "url/url_util.h" | 23 #include "url/url_util.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 private: | 132 private: |
130 #if !defined(OS_IOS) | 133 #if !defined(OS_IOS) |
131 std::unique_ptr<content::TestContentClientInitializer> content_initializer_; | 134 std::unique_ptr<content::TestContentClientInitializer> content_initializer_; |
132 #endif | 135 #endif |
133 | 136 |
134 DISALLOW_COPY_AND_ASSIGN(ComponentsUnitTestEventListener); | 137 DISALLOW_COPY_AND_ASSIGN(ComponentsUnitTestEventListener); |
135 }; | 138 }; |
136 | 139 |
137 } // namespace | 140 } // namespace |
138 | 141 |
139 int main(int argc, char** argv) { | 142 base::RunTestSuiteCallback GetLaunchCallback(int argc, char** argv) { |
140 #if !defined(OS_IOS) | 143 #if !defined(OS_IOS) |
141 content::UnitTestTestSuite test_suite(new ComponentsTestSuite(argc, argv)); | 144 auto test_suite = base::MakeUnique<content::UnitTestTestSuite>( |
| 145 new ComponentsTestSuite(argc, argv)); |
142 #else | 146 #else |
143 ComponentsTestSuite test_suite(argc, argv); | 147 auto test_suite = base::MakeUnique<ComponentsTestSuite>(argc, argv); |
144 #endif | 148 #endif |
145 | 149 |
146 // The listener will set up common test environment for all components unit | 150 // The listener will set up common test environment for all components unit |
147 // tests. | 151 // tests. |
148 testing::TestEventListeners& listeners = | 152 testing::TestEventListeners& listeners = |
149 testing::UnitTest::GetInstance()->listeners(); | 153 testing::UnitTest::GetInstance()->listeners(); |
150 listeners.Append(new ComponentsUnitTestEventListener()); | 154 listeners.Append(new ComponentsUnitTestEventListener()); |
151 | 155 |
152 #if !defined(OS_IOS) | 156 #if !defined(OS_IOS) |
153 mojo::edk::Init(); | 157 mojo::edk::Init(); |
154 return base::LaunchUnitTests(argc, argv, | 158 return base::Bind(&content::UnitTestTestSuite::Run, std::move(test_suite)); |
155 base::Bind(&content::UnitTestTestSuite::Run, | |
156 base::Unretained(&test_suite))); | |
157 #else | 159 #else |
158 return base::LaunchUnitTests( | 160 return base::Bind(&base::TestSuite::Run, std::move(test_suite)); |
159 argc, argv, base::Bind(&base::TestSuite::Run, | |
160 base::Unretained(&test_suite))); | |
161 #endif | 161 #endif |
162 } | 162 } |
OLD | NEW |