OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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" | 5 #include "components/test/components_test_suite.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/metrics/statistics_recorder.h" | 14 #include "base/metrics/statistics_recorder.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/test/launcher/unit_test_launcher.h" | 16 #include "base/test/launcher/unit_test_launcher.h" |
17 #include "base/test/test_suite.h" | 17 #include "base/test/test_suite.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "components/content_settings/core/common/content_settings_pattern.h" | 19 #include "components/content_settings/core/common/content_settings_pattern.h" |
20 #include "mojo/edk/embedder/embedder.h" | |
21 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
22 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
23 #include "ui/base/ui_base_paths.h" | 22 #include "ui/base/ui_base_paths.h" |
24 #include "url/url_util.h" | 23 #include "url/url_util.h" |
25 | 24 |
26 #if !defined(OS_IOS) | 25 #if !defined(OS_IOS) |
27 #include "content/public/common/content_client.h" | 26 #include "content/public/common/content_client.h" |
28 #include "content/public/test/content_test_suite_base.h" | 27 #include "content/public/test/content_test_suite_base.h" |
29 #include "content/public/test/test_content_client_initializer.h" | 28 #include "content/public/test/test_content_client_initializer.h" |
30 #include "content/public/test/unittest_test_suite.h" | 29 #include "content/public/test/unittest_test_suite.h" |
(...skipping 16 matching lines...) Expand all Loading... |
47 namespace { | 46 namespace { |
48 | 47 |
49 class ComponentsTestSuite : public base::TestSuite { | 48 class ComponentsTestSuite : public base::TestSuite { |
50 public: | 49 public: |
51 ComponentsTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} | 50 ComponentsTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} |
52 | 51 |
53 private: | 52 private: |
54 void Initialize() override { | 53 void Initialize() override { |
55 base::TestSuite::Initialize(); | 54 base::TestSuite::Initialize(); |
56 | 55 |
57 mojo::edk::Init(); | |
58 | |
59 // Initialize the histograms subsystem, so that any histograms hit in tests | 56 // Initialize the histograms subsystem, so that any histograms hit in tests |
60 // are correctly registered with the statistics recorder and can be queried | 57 // are correctly registered with the statistics recorder and can be queried |
61 // by tests. | 58 // by tests. |
62 base::StatisticsRecorder::Initialize(); | 59 base::StatisticsRecorder::Initialize(); |
63 | 60 |
64 #if !defined(OS_IOS) | 61 #if !defined(OS_IOS) |
65 gl::GLSurfaceTestSupport::InitializeOneOff(); | 62 gl::GLSurfaceTestSupport::InitializeOneOff(); |
66 | 63 |
67 // Setup content scheme statics. | 64 // Setup content scheme statics. |
68 { | 65 { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 testing::TestEventListeners& listeners = | 159 testing::TestEventListeners& listeners = |
163 testing::UnitTest::GetInstance()->listeners(); | 160 testing::UnitTest::GetInstance()->listeners(); |
164 listeners.Append(new ComponentsUnitTestEventListener()); | 161 listeners.Append(new ComponentsUnitTestEventListener()); |
165 | 162 |
166 #if !defined(OS_IOS) | 163 #if !defined(OS_IOS) |
167 return base::Bind(&content::UnitTestTestSuite::Run, std::move(test_suite)); | 164 return base::Bind(&content::UnitTestTestSuite::Run, std::move(test_suite)); |
168 #else | 165 #else |
169 return base::Bind(&base::TestSuite::Run, std::move(test_suite)); | 166 return base::Bind(&base::TestSuite::Run, std::move(test_suite)); |
170 #endif | 167 #endif |
171 } | 168 } |
OLD | NEW |