OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef BASE_TEST_LAUNCHER_TEST_LAUNCHER_H_ | 5 #ifndef BASE_TEST_LAUNCHER_TEST_LAUNCHER_H_ |
6 #define BASE_TEST_LAUNCHER_TEST_LAUNCHER_H_ | 6 #define BASE_TEST_LAUNCHER_TEST_LAUNCHER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 class TestCase; | 25 class TestCase; |
26 class TestInfo; | 26 class TestInfo; |
27 } | 27 } |
28 | 28 |
29 namespace base { | 29 namespace base { |
30 | 30 |
31 class CommandLine; | 31 class CommandLine; |
32 struct LaunchOptions; | 32 struct LaunchOptions; |
33 class SequencedWorkerPoolOwner; | 33 class SequencedWorkerPoolOwner; |
34 class TestLauncher; | 34 class TestLauncher; |
| 35 class Thread; |
35 | 36 |
36 // Constants for GTest command-line flags. | 37 // Constants for GTest command-line flags. |
37 extern const char kGTestFilterFlag[]; | 38 extern const char kGTestFilterFlag[]; |
38 extern const char kGTestFlagfileFlag[]; | 39 extern const char kGTestFlagfileFlag[]; |
39 extern const char kGTestHelpFlag[]; | 40 extern const char kGTestHelpFlag[]; |
40 extern const char kGTestListTestsFlag[]; | 41 extern const char kGTestListTestsFlag[]; |
41 extern const char kGTestRepeatFlag[]; | 42 extern const char kGTestRepeatFlag[]; |
42 extern const char kGTestRunDisabledTestsFlag[]; | 43 extern const char kGTestRunDisabledTestsFlag[]; |
43 extern const char kGTestOutputFlag[]; | 44 extern const char kGTestOutputFlag[]; |
44 | 45 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 const TimeDelta& elapsed_time, | 159 const TimeDelta& elapsed_time, |
159 bool was_timeout, | 160 bool was_timeout, |
160 const std::string& output); | 161 const std::string& output); |
161 | 162 |
162 // Called when a test iteration is finished. | 163 // Called when a test iteration is finished. |
163 void OnTestIterationFinished(); | 164 void OnTestIterationFinished(); |
164 | 165 |
165 // Called by the delay timer when no output was made for a while. | 166 // Called by the delay timer when no output was made for a while. |
166 void OnOutputTimeout(); | 167 void OnOutputTimeout(); |
167 | 168 |
| 169 // Returns the TaskRunner to be used to launch child test processes. This |
| 170 // TaskRunner will have TaskShutdownBehavior::BLOCK_SHUTDOWN semantics. |
| 171 scoped_refptr<TaskRunner> GetTaskRunner(); |
| 172 |
168 // Make sure we don't accidentally call the wrong methods e.g. on the worker | 173 // Make sure we don't accidentally call the wrong methods e.g. on the worker |
169 // pool thread. With lots of callbacks used this is non-trivial. | 174 // pool thread. With lots of callbacks used this is non-trivial. |
170 // Should be the first member so that it's destroyed last: when destroying | 175 // Should be the first member so that it's destroyed last: when destroying |
171 // other members, especially the worker pool, we may check the code is running | 176 // other members, especially the worker pool, we may check the code is running |
172 // on the correct thread. | 177 // on the correct thread. |
173 ThreadChecker thread_checker_; | 178 ThreadChecker thread_checker_; |
174 | 179 |
175 TestLauncherDelegate* launcher_delegate_; | 180 TestLauncherDelegate* launcher_delegate_; |
176 | 181 |
177 // Support for outer sharding, just like gtest does. | 182 // Support for outer sharding, just like gtest does. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 bool run_result_; | 225 bool run_result_; |
221 | 226 |
222 TestResultsTracker results_tracker_; | 227 TestResultsTracker results_tracker_; |
223 | 228 |
224 // Watchdog timer to make sure we do not go without output for too long. | 229 // Watchdog timer to make sure we do not go without output for too long. |
225 DelayTimer watchdog_timer_; | 230 DelayTimer watchdog_timer_; |
226 | 231 |
227 // Number of jobs to run in parallel. | 232 // Number of jobs to run in parallel. |
228 size_t parallel_jobs_; | 233 size_t parallel_jobs_; |
229 | 234 |
230 // Worker pool used to launch processes in parallel. | 235 // Worker pool used to launch processes in parallel (|worker_thread_| is used |
| 236 // instead if |parallel_jobs == 1|). |
231 std::unique_ptr<SequencedWorkerPoolOwner> worker_pool_owner_; | 237 std::unique_ptr<SequencedWorkerPoolOwner> worker_pool_owner_; |
| 238 std::unique_ptr<Thread> worker_thread_; |
232 | 239 |
233 DISALLOW_COPY_AND_ASSIGN(TestLauncher); | 240 DISALLOW_COPY_AND_ASSIGN(TestLauncher); |
234 }; | 241 }; |
235 | 242 |
236 // Extract part from |full_output| that applies to |result|. | 243 // Extract part from |full_output| that applies to |result|. |
237 std::string GetTestOutputSnippet(const TestResult& result, | 244 std::string GetTestOutputSnippet(const TestResult& result, |
238 const std::string& full_output); | 245 const std::string& full_output); |
239 | 246 |
240 } // namespace base | 247 } // namespace base |
241 | 248 |
242 #endif // BASE_TEST_LAUNCHER_TEST_LAUNCHER_H_ | 249 #endif // BASE_TEST_LAUNCHER_TEST_LAUNCHER_H_ |
OLD | NEW |