| 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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 extern const char kGTestRunDisabledTestsFlag[]; | 36 extern const char kGTestRunDisabledTestsFlag[]; |
| 37 extern const char kGTestOutputFlag[]; | 37 extern const char kGTestOutputFlag[]; |
| 38 | 38 |
| 39 // Interface for use with LaunchTests that abstracts away exact details | 39 // Interface for use with LaunchTests that abstracts away exact details |
| 40 // which tests and how are run. | 40 // which tests and how are run. |
| 41 class TestLauncherDelegate { | 41 class TestLauncherDelegate { |
| 42 public: | 42 public: |
| 43 // Called before a test is considered for running. If it returns false, | 43 // Called before a test is considered for running. If it returns false, |
| 44 // the test is not run. If it returns true, the test will be run provided | 44 // the test is not run. If it returns true, the test will be run provided |
| 45 // it is part of the current shard. | 45 // it is part of the current shard. |
| 46 virtual bool ShouldRunTest(const testing::TestCase* test_case, | 46 virtual bool ShouldRunTest(const std::string& test_case_name, |
| 47 const testing::TestInfo* test_info) = 0; | 47 const std::string& test_name) = 0; |
| 48 | 48 |
| 49 // Called to make the delegate run the specified tests. The delegate must | 49 // Called to make the delegate run the specified tests. The delegate must |
| 50 // return the number of actual tests it's going to run (can be smaller, | 50 // return the number of actual tests it's going to run (can be smaller, |
| 51 // equal to, or larger than size of |test_names|). It must also call | 51 // equal to, or larger than size of |test_names|). It must also call |
| 52 // |test_launcher|'s OnTestFinished method once per every run test, | 52 // |test_launcher|'s OnTestFinished method once per every run test, |
| 53 // regardless of its success. | 53 // regardless of its success. |
| 54 virtual size_t RunTests(TestLauncher* test_launcher, | 54 virtual size_t RunTests(TestLauncher* test_launcher, |
| 55 const std::vector<std::string>& test_names) = 0; | 55 const std::vector<std::string>& test_names) = 0; |
| 56 | 56 |
| 57 // Called to make the delegate retry the specified tests. The delegate must | 57 // Called to make the delegate retry the specified tests. The delegate must |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 DISALLOW_COPY_AND_ASSIGN(TestLauncher); | 197 DISALLOW_COPY_AND_ASSIGN(TestLauncher); |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 // Extract part from |full_output| that applies to |result|. | 200 // Extract part from |full_output| that applies to |result|. |
| 201 std::string GetTestOutputSnippet(const TestResult& result, | 201 std::string GetTestOutputSnippet(const TestResult& result, |
| 202 const std::string& full_output); | 202 const std::string& full_output); |
| 203 | 203 |
| 204 } // namespace base | 204 } // namespace base |
| 205 | 205 |
| 206 #endif // BASE_TEST_LAUNCHER_TEST_LAUNCHER_H_ | 206 #endif // BASE_TEST_LAUNCHER_TEST_LAUNCHER_H_ |
| OLD | NEW |