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

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

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 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
« no previous file with comments | « base/test/launcher/test_launcher_ios.cc ('k') | base/test/launcher/unit_test_launcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 15 matching lines...) Expand all
26 26
27 #if defined(OS_WIN) 27 #if defined(OS_WIN)
28 // Launches unit tests in given test suite. Returns exit code. 28 // Launches unit tests in given test suite. Returns exit code.
29 // |use_job_objects| determines whether to use job objects. 29 // |use_job_objects| determines whether to use job objects.
30 int LaunchUnitTests(int argc, 30 int LaunchUnitTests(int argc,
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.
37 class UnitTestPlatformDelegate {
38 public:
39 // Called to get names of tests available for running. The delegate
40 // must put the result in |output| and return true on success.
41 virtual bool GetTests(std::vector<SplitTestName>* output) = 0;
42
43 // Called to create a temporary file. The delegate must put the resulting
44 // path in |path| and return true on success.
45 virtual bool CreateTemporaryFile(base::FilePath* path) = 0;
46
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
49 // (e.g. "A.B"), |output_file| is path to the GTest XML output file.
50 virtual CommandLine GetCommandLineForChildGTestProcess(
51 const std::vector<std::string>& test_names,
52 const base::FilePath& output_file) = 0;
53
54 // Returns wrapper to use for child GTest process. Empty string means
55 // no wrapper.
56 virtual std::string GetWrapperForChildGTestProcess() = 0;
57
58 protected:
59 ~UnitTestPlatformDelegate() {}
60 };
61
36 // Test launcher delegate for unit tests (mostly to support batching). 62 // Test launcher delegate for unit tests (mostly to support batching).
37 class UnitTestLauncherDelegate : public TestLauncherDelegate { 63 class UnitTestLauncherDelegate : public TestLauncherDelegate {
38 public: 64 public:
39 explicit UnitTestLauncherDelegate(size_t batch_limit, bool use_job_objects); 65 UnitTestLauncherDelegate(UnitTestPlatformDelegate* delegate,
66 size_t batch_limit,
67 bool use_job_objects);
40 ~UnitTestLauncherDelegate() override; 68 ~UnitTestLauncherDelegate() override;
41 69
42 private: 70 private:
43 struct GTestCallbackState { 71 struct GTestCallbackState {
44 GTestCallbackState(); 72 GTestCallbackState();
45 ~GTestCallbackState(); 73 ~GTestCallbackState();
46 74
47 TestLauncher* test_launcher; 75 TestLauncher* test_launcher;
48 std::vector<std::string> test_names; 76 std::vector<std::string> test_names;
49 FilePath output_file; 77 FilePath output_file;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 static bool ProcessTestResults(TestLauncher* test_launcher, 114 static bool ProcessTestResults(TestLauncher* test_launcher,
87 const std::vector<std::string>& test_names, 115 const std::vector<std::string>& test_names,
88 const base::FilePath& output_file, 116 const base::FilePath& output_file,
89 const std::string& output, 117 const std::string& output,
90 int exit_code, 118 int exit_code,
91 bool was_timeout, 119 bool was_timeout,
92 std::vector<std::string>* tests_to_relaunch); 120 std::vector<std::string>* tests_to_relaunch);
93 121
94 ThreadChecker thread_checker_; 122 ThreadChecker thread_checker_;
95 123
124 UnitTestPlatformDelegate* platform_delegate_;
125
96 // Maximum number of tests to run in a single batch. 126 // Maximum number of tests to run in a single batch.
97 size_t batch_limit_; 127 size_t batch_limit_;
98 128
99 // Determines whether we use job objects on Windows. 129 // Determines whether we use job objects on Windows.
100 bool use_job_objects_; 130 bool use_job_objects_;
101 131
102 DISALLOW_COPY_AND_ASSIGN(UnitTestLauncherDelegate); 132 DISALLOW_COPY_AND_ASSIGN(UnitTestLauncherDelegate);
103 }; 133 };
104 134
105 } // namespace base 135 } // namespace base
106 136
107 #endif // BASE_TEST_LAUNCHER_UNIT_TEST_LAUNCHER_H_ 137 #endif // BASE_TEST_LAUNCHER_UNIT_TEST_LAUNCHER_H_
OLDNEW
« no previous file with comments | « base/test/launcher/test_launcher_ios.cc ('k') | base/test/launcher/unit_test_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698