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" |
(...skipping 20 matching lines...) Expand all Loading... |
31 wchar_t** argv, | 31 wchar_t** argv, |
32 bool use_job_objects, | 32 bool use_job_objects, |
33 const RunTestSuiteCallback& run_test_suite); | 33 const RunTestSuiteCallback& run_test_suite); |
34 #endif // defined(OS_WIN) | 34 #endif // defined(OS_WIN) |
35 | 35 |
36 // Delegate to abstract away platform differences for unit tests. | 36 // Delegate to abstract away platform differences for unit tests. |
37 class UnitTestPlatformDelegate { | 37 class UnitTestPlatformDelegate { |
38 public: | 38 public: |
39 // Called to get names of tests available for running. The delegate | 39 // Called to get names of tests available for running. The delegate |
40 // must put the result in |output| and return true on success. | 40 // must put the result in |output| and return true on success. |
41 virtual bool GetTests(std::vector<SplitTestName>* output) = 0; | 41 virtual bool GetTests(std::vector<TestIdentifier>* output) = 0; |
42 | 42 |
43 // Called to create a temporary file. The delegate must put the resulting | 43 // Called to create a temporary file. The delegate must put the resulting |
44 // path in |path| and return true on success. | 44 // path in |path| and return true on success. |
45 virtual bool CreateTemporaryFile(base::FilePath* path) = 0; | 45 virtual bool CreateTemporaryFile(base::FilePath* path) = 0; |
46 | 46 |
47 // Returns command line for child GTest process based on the command line | 47 // Returns command line for child GTest process based on the command line |
48 // of current process. |test_names| is a vector of test full names | 48 // of current process. |test_names| is a vector of test full names |
49 // (e.g. "A.B"), |output_file| is path to the GTest XML output file. | 49 // (e.g. "A.B"), |output_file| is path to the GTest XML output file. |
50 virtual CommandLine GetCommandLineForChildGTestProcess( | 50 virtual CommandLine GetCommandLineForChildGTestProcess( |
51 const std::vector<std::string>& test_names, | 51 const std::vector<std::string>& test_names, |
(...skipping 27 matching lines...) Expand all Loading... |
79 // Test launcher delegate for unit tests (mostly to support batching). | 79 // Test launcher delegate for unit tests (mostly to support batching). |
80 class UnitTestLauncherDelegate : public TestLauncherDelegate { | 80 class UnitTestLauncherDelegate : public TestLauncherDelegate { |
81 public: | 81 public: |
82 UnitTestLauncherDelegate(UnitTestPlatformDelegate* delegate, | 82 UnitTestLauncherDelegate(UnitTestPlatformDelegate* delegate, |
83 size_t batch_limit, | 83 size_t batch_limit, |
84 bool use_job_objects); | 84 bool use_job_objects); |
85 ~UnitTestLauncherDelegate() override; | 85 ~UnitTestLauncherDelegate() override; |
86 | 86 |
87 private: | 87 private: |
88 // TestLauncherDelegate: | 88 // TestLauncherDelegate: |
89 bool GetTests(std::vector<SplitTestName>* output) override; | 89 bool GetTests(std::vector<TestIdentifier>* output) override; |
90 bool ShouldRunTest(const std::string& test_case_name, | 90 bool ShouldRunTest(const std::string& test_case_name, |
91 const std::string& test_name) override; | 91 const std::string& test_name) override; |
92 size_t RunTests(TestLauncher* test_launcher, | 92 size_t RunTests(TestLauncher* test_launcher, |
93 const std::vector<std::string>& test_names) override; | 93 const std::vector<std::string>& test_names) override; |
94 size_t RetryTests(TestLauncher* test_launcher, | 94 size_t RetryTests(TestLauncher* test_launcher, |
95 const std::vector<std::string>& test_names) override; | 95 const std::vector<std::string>& test_names) override; |
96 | 96 |
97 ThreadChecker thread_checker_; | 97 ThreadChecker thread_checker_; |
98 | 98 |
99 UnitTestPlatformDelegate* platform_delegate_; | 99 UnitTestPlatformDelegate* platform_delegate_; |
100 | 100 |
101 // Maximum number of tests to run in a single batch. | 101 // Maximum number of tests to run in a single batch. |
102 size_t batch_limit_; | 102 size_t batch_limit_; |
103 | 103 |
104 // Determines whether we use job objects on Windows. | 104 // Determines whether we use job objects on Windows. |
105 bool use_job_objects_; | 105 bool use_job_objects_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(UnitTestLauncherDelegate); | 107 DISALLOW_COPY_AND_ASSIGN(UnitTestLauncherDelegate); |
108 }; | 108 }; |
109 | 109 |
110 } // namespace base | 110 } // namespace base |
111 | 111 |
112 #endif // BASE_TEST_LAUNCHER_UNIT_TEST_LAUNCHER_H_ | 112 #endif // BASE_TEST_LAUNCHER_UNIT_TEST_LAUNCHER_H_ |
OLD | NEW |