Index: base/test/multiprocess_test.h |
diff --git a/base/test/multiprocess_test.h b/base/test/multiprocess_test.h |
index bf9663759e05bb0136a32f99f9ad5c8f5f50c4ad..f0027d9458a802793f1b272b22423633bc78ca2b 100644 |
--- a/base/test/multiprocess_test.h |
+++ b/base/test/multiprocess_test.h |
@@ -17,6 +17,17 @@ namespace base { |
class CommandLine; |
+struct SpawnChildResult { |
+ SpawnChildResult() {} |
+ SpawnChildResult(SpawnChildResult&& other) = default; |
+ |
+ SpawnChildResult& operator=(SpawnChildResult&& other) = default; |
+ |
+ Process process; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SpawnChildResult); |
+}; |
+ |
// Helpers to spawn a child for a multiprocess test and execute a designated |
// function. Use these when you already have another base class for your test |
// fixture, but you want (some) of your tests to be multiprocess (otherwise you |
@@ -33,9 +44,10 @@ class CommandLine; |
// // Maybe set some options (e.g., |start_hidden| on Windows).... |
// |
// // Start a child process and run |a_test_func|. |
-// base::Process test_child_process = |
+// SpawnChildResult result = |
// base::SpawnMultiProcessTestChild("a_test_func", command_line, |
// options); |
+// base::Process test_child_process = std::move(result.process); |
// |
// // Do stuff involving |test_child_process| and the child process.... |
// |
@@ -61,10 +73,9 @@ class CommandLine; |
// |command_line| should be as provided by |
// |GetMultiProcessTestChildBaseCommandLine()| (below), possibly with arguments |
// added. Note: On Windows, you probably want to set |options.start_hidden|. |
-Process SpawnMultiProcessTestChild( |
- const std::string& procname, |
- const CommandLine& command_line, |
- const LaunchOptions& options); |
+SpawnChildResult SpawnMultiProcessTestChild(const std::string& procname, |
+ const CommandLine& command_line, |
+ const LaunchOptions& options); |
// Gets the base command line for |SpawnMultiProcessTestChild()|. To this, you |
// may add any flags needed for your child process. |
@@ -121,13 +132,13 @@ class MultiProcessTest : public PlatformTest { |
// } |
// |
// Returns the child process. |
- Process SpawnChild(const std::string& procname); |
+ SpawnChildResult SpawnChild(const std::string& procname); |
// Run a child process using the given launch options. |
// |
// Note: On Windows, you probably want to set |options.start_hidden|. |
- Process SpawnChildWithOptions(const std::string& procname, |
- const LaunchOptions& options); |
+ SpawnChildResult SpawnChildWithOptions(const std::string& procname, |
+ const LaunchOptions& options); |
// Set up the command line used to spawn the child process. |
// Override this to add things to the command line (calling this first in the |