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_UNIT_TEST_LAUNCHER_H_ | 5 #ifndef BASE_TEST_LAUNCHER_UNIT_TEST_LAUNCHER_H_ |
6 #define BASE_TEST_LAUNCHER_UNIT_TEST_LAUNCHER_H_ | 6 #define BASE_TEST_LAUNCHER_UNIT_TEST_LAUNCHER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/test/launcher/test_launcher.h" | 10 #include "base/test/launcher/test_launcher.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 | 13 |
14 // Callback that runs a test suite and returns exit code. | 14 // Callback that runs a test suite and returns exit code. |
15 typedef base::Callback<int(void)> RunTestSuiteCallback; | 15 typedef base::Callback<int(void)> RunTestSuiteCallback; |
16 | 16 |
17 // Launches unit tests in given test suite. Returns exit code. | 17 // Launches unit tests in given test suite. Returns exit code. |
18 int LaunchUnitTests(int argc, | 18 int LaunchUnitTests(int argc, |
19 char** argv, | 19 char** argv, |
20 const RunTestSuiteCallback& run_test_suite); | 20 const RunTestSuiteCallback& run_test_suite); |
21 | 21 |
22 // Same as above, but always runs tests serially. | 22 // Same as above, but always runs tests serially. |
23 int LaunchUnitTestsSerially(int argc, | 23 int LaunchUnitTestsSerially(int argc, |
24 char** argv, | 24 char** argv, |
25 const RunTestSuiteCallback& run_test_suite); | 25 const RunTestSuiteCallback& run_test_suite); |
26 | 26 |
27 #if defined(OS_WIN) | |
28 // Launches unit tests in given test suite. Returns exit code. | |
29 // |use_job_objects| determines whether to use job objects. | |
30 int LaunchUnitTests(int argc, | |
31 wchar_t** argv, | |
32 bool use_job_objects, | |
33 const RunTestSuiteCallback& run_test_suite); | |
34 #endif // defined(OS_WIN) | |
35 | |
36 // Delegate to abstract away platform differences for unit tests. | 27 // Delegate to abstract away platform differences for unit tests. |
37 class UnitTestPlatformDelegate { | 28 class UnitTestPlatformDelegate { |
38 public: | 29 public: |
39 // Called to get names of tests available for running. The delegate | 30 // Called to get names of tests available for running. The delegate |
40 // must put the result in |output| and return true on success. | 31 // must put the result in |output| and return true on success. |
41 virtual bool GetTests(std::vector<SplitTestName>* output) = 0; | 32 virtual bool GetTests(std::vector<SplitTestName>* output) = 0; |
42 | 33 |
43 // Called to create a temporary file. The delegate must put the resulting | 34 // Called to create a temporary file. The delegate must put the resulting |
44 // path in |path| and return true on success. | 35 // path in |path| and return true on success. |
45 virtual bool CreateTemporaryFile(base::FilePath* path) = 0; | 36 virtual bool CreateTemporaryFile(base::FilePath* path) = 0; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 94 |
104 // Determines whether we use job objects on Windows. | 95 // Determines whether we use job objects on Windows. |
105 bool use_job_objects_; | 96 bool use_job_objects_; |
106 | 97 |
107 DISALLOW_COPY_AND_ASSIGN(UnitTestLauncherDelegate); | 98 DISALLOW_COPY_AND_ASSIGN(UnitTestLauncherDelegate); |
108 }; | 99 }; |
109 | 100 |
110 } // namespace base | 101 } // namespace base |
111 | 102 |
112 #endif // BASE_TEST_LAUNCHER_UNIT_TEST_LAUNCHER_H_ | 103 #endif // BASE_TEST_LAUNCHER_UNIT_TEST_LAUNCHER_H_ |
OLD | NEW |