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

Unified Diff: base/test/multiprocess_test.h

Issue 2733323002: Changing multiprocess test SpawnChild to return a struct. (Closed)
Patch Set: Synced Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/process/process_util_unittest.cc ('k') | base/test/multiprocess_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « base/process/process_util_unittest.cc ('k') | base/test/multiprocess_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698