diff options
Diffstat (limited to 'base/test')
-rw-r--r-- | base/test/multiprocess_test.cc | 10 | ||||
-rw-r--r-- | base/test/multiprocess_test.h | 12 | ||||
-rw-r--r-- | base/test/multiprocess_test_android.cc | 12 |
3 files changed, 16 insertions, 18 deletions
diff --git a/base/test/multiprocess_test.cc b/base/test/multiprocess_test.cc index 306c109..b95ea98 100644 --- a/base/test/multiprocess_test.cc +++ b/base/test/multiprocess_test.cc @@ -10,7 +10,7 @@ namespace base { #if !defined(OS_ANDROID) -ProcessHandle SpawnMultiProcessTestChild( +Process SpawnMultiProcessTestChild( const std::string& procname, const CommandLine& base_command_line, const LaunchOptions& options) { @@ -21,9 +21,7 @@ ProcessHandle SpawnMultiProcessTestChild( if (!command_line.HasSwitch(switches::kTestChildProcess)) command_line.AppendSwitchASCII(switches::kTestChildProcess, procname); - ProcessHandle handle = kNullProcessHandle; - LaunchProcess(command_line, options, &handle); - return handle; + return LaunchProcess(command_line, options); } #endif // !defined(OS_ANDROID) @@ -36,7 +34,7 @@ CommandLine GetMultiProcessTestChildBaseCommandLine() { MultiProcessTest::MultiProcessTest() { } -ProcessHandle MultiProcessTest::SpawnChild(const std::string& procname) { +Process MultiProcessTest::SpawnChild(const std::string& procname) { LaunchOptions options; #if defined(OS_WIN) options.start_hidden = true; @@ -44,7 +42,7 @@ ProcessHandle MultiProcessTest::SpawnChild(const std::string& procname) { return SpawnChildWithOptions(procname, options); } -ProcessHandle MultiProcessTest::SpawnChildWithOptions( +Process MultiProcessTest::SpawnChildWithOptions( const std::string& procname, const LaunchOptions& options) { return SpawnMultiProcessTestChild(procname, MakeCmdLine(procname), options); diff --git a/base/test/multiprocess_test.h b/base/test/multiprocess_test.h index b830f73..e419503 100644 --- a/base/test/multiprocess_test.h +++ b/base/test/multiprocess_test.h @@ -9,7 +9,7 @@ #include "base/basictypes.h" #include "base/process/launch.h" -#include "base/process/process_handle.h" +#include "base/process/process.h" #include "build/build_config.h" #include "testing/platform_test.h" @@ -58,7 +58,7 @@ 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|. -ProcessHandle SpawnMultiProcessTestChild( +Process SpawnMultiProcessTestChild( const std::string& procname, const CommandLine& command_line, const LaunchOptions& options); @@ -105,14 +105,14 @@ class MultiProcessTest : public PlatformTest { // // do client work here // } // - // Returns the handle to the child, or NULL on failure - ProcessHandle SpawnChild(const std::string& procname); + // Returns the child process. + Process 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|. - ProcessHandle SpawnChildWithOptions(const std::string& procname, - const LaunchOptions& options); + Process 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 diff --git a/base/test/multiprocess_test_android.cc b/base/test/multiprocess_test_android.cc index 8f54b82..dc489d1 100644 --- a/base/test/multiprocess_test_android.cc +++ b/base/test/multiprocess_test_android.cc @@ -19,9 +19,9 @@ namespace base { // and we don't have an executable to exec*. This implementation does the bare // minimum to execute the method specified by procname (in the child process). // - All options except |fds_to_remap| are ignored. -ProcessHandle SpawnMultiProcessTestChild(const std::string& procname, - const CommandLine& base_command_line, - const LaunchOptions& options) { +Process SpawnMultiProcessTestChild(const std::string& procname, + const CommandLine& base_command_line, + const LaunchOptions& options) { // TODO(viettrungluu): The FD-remapping done below is wrong in the presence of // cycles (e.g., fd1 -> fd2, fd2 -> fd1). crbug.com/326576 FileHandleMappingVector empty; @@ -32,11 +32,11 @@ ProcessHandle SpawnMultiProcessTestChild(const std::string& procname, if (pid < 0) { PLOG(ERROR) << "fork"; - return kNullProcessHandle; + return Process(); } if (pid > 0) { // Parent process. - return pid; + return Process(pid); } // Child process. base::hash_set<int> fds_to_keep_open; @@ -69,7 +69,7 @@ ProcessHandle SpawnMultiProcessTestChild(const std::string& procname, command_line->AppendSwitchASCII(switches::kTestChildProcess, procname); _exit(multi_process_function_list::InvokeChildProcessTest(procname)); - return 0; + return Process(); } } // namespace base |