Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: base/test/launcher/test_launcher.h

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/test/gtest_util.h"
14 #include "base/test/launcher/test_result.h" 15 #include "base/test/launcher/test_result.h"
15 #include "base/test/launcher/test_results_tracker.h" 16 #include "base/test/launcher/test_results_tracker.h"
16 #include "base/time/time.h" 17 #include "base/time/time.h"
17 #include "base/timer/timer.h" 18 #include "base/timer/timer.h"
18 19
19 namespace testing { 20 namespace testing {
20 class TestCase; 21 class TestCase;
21 class TestInfo; 22 class TestInfo;
22 } 23 }
23 24
24 namespace base { 25 namespace base {
25 26
26 class CommandLine; 27 class CommandLine;
27 struct LaunchOptions; 28 struct LaunchOptions;
28 class SequencedWorkerPoolOwner; 29 class SequencedWorkerPoolOwner;
29 class TestLauncher; 30 class TestLauncher;
30 31
31 // Constants for GTest command-line flags. 32 // Constants for GTest command-line flags.
32 extern const char kGTestFilterFlag[]; 33 extern const char kGTestFilterFlag[];
33 extern const char kGTestHelpFlag[]; 34 extern const char kGTestHelpFlag[];
34 extern const char kGTestListTestsFlag[]; 35 extern const char kGTestListTestsFlag[];
35 extern const char kGTestRepeatFlag[]; 36 extern const char kGTestRepeatFlag[];
36 extern const char kGTestRunDisabledTestsFlag[]; 37 extern const char kGTestRunDisabledTestsFlag[];
37 extern const char kGTestOutputFlag[]; 38 extern const char kGTestOutputFlag[];
38 39
39 // Interface for use with LaunchTests that abstracts away exact details 40 // Interface for use with LaunchTests that abstracts away exact details
40 // which tests and how are run. 41 // which tests and how are run.
41 class TestLauncherDelegate { 42 class TestLauncherDelegate {
42 public: 43 public:
44 // Called to get names of tests available for running. The delegate
45 // must put the result in |output| and return true on success.
46 virtual bool GetTests(std::vector<SplitTestName>* output) = 0;
47
43 // Called before a test is considered for running. If it returns false, 48 // 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 49 // the test is not run. If it returns true, the test will be run provided
45 // it is part of the current shard. 50 // it is part of the current shard.
46 virtual bool ShouldRunTest(const std::string& test_case_name, 51 virtual bool ShouldRunTest(const std::string& test_case_name,
47 const std::string& test_name) = 0; 52 const std::string& test_name) = 0;
48 53
49 // Called to make the delegate run the specified tests. The delegate must 54 // 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, 55 // 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 56 // equal to, or larger than size of |test_names|). It must also call
52 // |test_launcher|'s OnTestFinished method once per every run test, 57 // |test_launcher|'s OnTestFinished method once per every run test,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // Support for outer sharding, just like gtest does. 156 // Support for outer sharding, just like gtest does.
152 int32 total_shards_; // Total number of outer shards, at least one. 157 int32 total_shards_; // Total number of outer shards, at least one.
153 int32 shard_index_; // Index of shard the launcher is to run. 158 int32 shard_index_; // Index of shard the launcher is to run.
154 159
155 int cycles_; // Number of remaining test itreations, or -1 for infinite. 160 int cycles_; // Number of remaining test itreations, or -1 for infinite.
156 161
157 // Test filters (empty means no filter). 162 // Test filters (empty means no filter).
158 std::vector<std::string> positive_test_filter_; 163 std::vector<std::string> positive_test_filter_;
159 std::vector<std::string> negative_test_filter_; 164 std::vector<std::string> negative_test_filter_;
160 165
166 // Tests to use (cached result of TestLauncherDelegate::GetTests).
167 std::vector<SplitTestName> tests_;
168
161 // Number of tests started in this iteration. 169 // Number of tests started in this iteration.
162 size_t test_started_count_; 170 size_t test_started_count_;
163 171
164 // Number of tests finished in this iteration. 172 // Number of tests finished in this iteration.
165 size_t test_finished_count_; 173 size_t test_finished_count_;
166 174
167 // Number of tests successfully finished in this iteration. 175 // Number of tests successfully finished in this iteration.
168 size_t test_success_count_; 176 size_t test_success_count_;
169 177
170 // Number of tests either timing out or having an unknown result, 178 // Number of tests either timing out or having an unknown result,
(...skipping 26 matching lines...) Expand all
197 DISALLOW_COPY_AND_ASSIGN(TestLauncher); 205 DISALLOW_COPY_AND_ASSIGN(TestLauncher);
198 }; 206 };
199 207
200 // Extract part from |full_output| that applies to |result|. 208 // Extract part from |full_output| that applies to |result|.
201 std::string GetTestOutputSnippet(const TestResult& result, 209 std::string GetTestOutputSnippet(const TestResult& result,
202 const std::string& full_output); 210 const std::string& full_output);
203 211
204 } // namespace base 212 } // namespace base
205 213
206 #endif // BASE_TEST_LAUNCHER_TEST_LAUNCHER_H_ 214 #endif // BASE_TEST_LAUNCHER_TEST_LAUNCHER_H_
OLDNEW
« no previous file with comments | « base/test/gtest_util.cc ('k') | base/test/launcher/test_launcher.cc » ('j') | shell/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698