Chromium Code Reviews| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 | 90 |
| 91 void Shutdown() override { | 91 void Shutdown() override { |
| 92 ui::ResourceBundle::CleanupSharedInstance(); | 92 ui::ResourceBundle::CleanupSharedInstance(); |
| 93 | 93 |
| 94 base::TestSuite::Shutdown(); | 94 base::TestSuite::Shutdown(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 DISALLOW_COPY_AND_ASSIGN(ComponentsTestSuite); | 97 DISALLOW_COPY_AND_ASSIGN(ComponentsTestSuite); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 #if !defined(OS_IOS) | |
|
Dirk Pranke
2015/09/09 20:37:28
why do we need this change if we don't need it in
sdefresne
2015/09/10 08:45:49
This was how it was done in the version of patchse
| |
| 100 class ComponentsUnitTestEventListener : public testing::EmptyTestEventListener { | 101 class ComponentsUnitTestEventListener : public testing::EmptyTestEventListener { |
| 101 public: | 102 public: |
| 102 ComponentsUnitTestEventListener() {} | 103 ComponentsUnitTestEventListener() {} |
| 103 ~ComponentsUnitTestEventListener() override {} | 104 ~ComponentsUnitTestEventListener() override {} |
| 104 | 105 |
| 105 void OnTestStart(const testing::TestInfo& test_info) override { | 106 void OnTestStart(const testing::TestInfo& test_info) override { |
| 106 #if !defined(OS_IOS) | 107 #if !defined(OS_IOS) |
| 107 content_initializer_.reset(new content::TestContentClientInitializer()); | 108 content_initializer_.reset(new content::TestContentClientInitializer()); |
| 108 #endif | 109 #endif |
| 109 } | 110 } |
| 110 | 111 |
| 111 void OnTestEnd(const testing::TestInfo& test_info) override { | 112 void OnTestEnd(const testing::TestInfo& test_info) override { |
| 112 #if !defined(OS_IOS) | 113 #if !defined(OS_IOS) |
| 113 content_initializer_.reset(); | 114 content_initializer_.reset(); |
| 114 #endif | 115 #endif |
| 115 } | 116 } |
| 116 | 117 |
| 117 private: | 118 private: |
| 118 #if !defined(OS_IOS) | 119 #if !defined(OS_IOS) |
| 119 scoped_ptr<content::TestContentClientInitializer> content_initializer_; | 120 scoped_ptr<content::TestContentClientInitializer> content_initializer_; |
| 120 #endif | 121 #endif |
| 121 | 122 |
| 122 DISALLOW_COPY_AND_ASSIGN(ComponentsUnitTestEventListener); | 123 DISALLOW_COPY_AND_ASSIGN(ComponentsUnitTestEventListener); |
| 123 }; | 124 }; |
| 125 #endif // !defined(OS_IOS) | |
| 124 | 126 |
| 125 } // namespace | 127 } // namespace |
| 126 | 128 |
| 127 int main(int argc, char** argv) { | 129 int main(int argc, char** argv) { |
| 128 ComponentsTestSuite test_suite(argc, argv); | 130 ComponentsTestSuite test_suite(argc, argv); |
| 129 | 131 |
| 132 #if !defined(OS_IOS) | |
| 130 // The listener will set up common test environment for all components unit | 133 // The listener will set up common test environment for all components unit |
| 131 // tests. | 134 // tests. |
| 132 testing::TestEventListeners& listeners = | 135 testing::TestEventListeners& listeners = |
| 133 testing::UnitTest::GetInstance()->listeners(); | 136 testing::UnitTest::GetInstance()->listeners(); |
| 134 listeners.Append(new ComponentsUnitTestEventListener()); | 137 listeners.Append(new ComponentsUnitTestEventListener()); |
| 138 #endif // !defined(OS_IOS) | |
| 135 | 139 |
| 136 return base::LaunchUnitTests( | 140 return base::LaunchUnitTests( |
| 137 argc, argv, base::Bind(&base::TestSuite::Run, | 141 argc, argv, base::Bind(&base::TestSuite::Run, |
| 138 base::Unretained(&test_suite))); | 142 base::Unretained(&test_suite))); |
| 139 } | 143 } |
| OLD | NEW |