| Index: base/process/process_util_unittest.cc
|
| diff --git a/base/process/process_util_unittest.cc b/base/process/process_util_unittest.cc
|
| index 7031706e0b7796721e098ca6b72aa2b8b126b7f6..94556425292a79667cc0e90b2e23b47f193ba7fb 100644
|
| --- a/base/process/process_util_unittest.cc
|
| +++ b/base/process/process_util_unittest.cc
|
| @@ -160,7 +160,8 @@ MULTIPROCESS_TEST_MAIN(SimpleChildProcess) {
|
|
|
| // TODO(viettrungluu): This should be in a "MultiProcessTestTest".
|
| TEST_F(ProcessUtilTest, SpawnChild) {
|
| - base::Process process = SpawnChild("SimpleChildProcess");
|
| + base::SpawnChildResult spawn_result = SpawnChild("SimpleChildProcess");
|
| + base::Process process = std::move(spawn_result.process);
|
| ASSERT_TRUE(process.IsValid());
|
| int exit_code;
|
| EXPECT_TRUE(process.WaitForExitWithTimeout(
|
| @@ -176,7 +177,8 @@ TEST_F(ProcessUtilTest, KillSlowChild) {
|
| const std::string signal_file =
|
| ProcessUtilTest::GetSignalFilePath(kSignalFileSlow);
|
| remove(signal_file.c_str());
|
| - base::Process process = SpawnChild("SlowChildProcess");
|
| + base::SpawnChildResult spawn_result = SpawnChild("SlowChildProcess");
|
| + base::Process process = std::move(spawn_result.process);
|
| ASSERT_TRUE(process.IsValid());
|
| SignalChildren(signal_file.c_str());
|
| int exit_code;
|
| @@ -190,7 +192,8 @@ TEST_F(ProcessUtilTest, DISABLED_GetTerminationStatusExit) {
|
| const std::string signal_file =
|
| ProcessUtilTest::GetSignalFilePath(kSignalFileSlow);
|
| remove(signal_file.c_str());
|
| - base::Process process = SpawnChild("SlowChildProcess");
|
| + base::SpawnChildResult spawn_result = SpawnChild("SlowChildProcess");
|
| + base::Process process = std::move(spawn_result.process);
|
| ASSERT_TRUE(process.IsValid());
|
|
|
| int exit_code = 42;
|
| @@ -235,7 +238,9 @@ TEST_F(ProcessUtilTest, CurrentDirectory) {
|
| base::LaunchOptions options;
|
| options.current_directory = tmp_dir;
|
|
|
| - base::Process process(SpawnChildWithOptions("CheckCwdProcess", options));
|
| + base::SpawnChildResult spawn_result =
|
| + SpawnChildWithOptions("CheckCwdProcess", options);
|
| + base::Process process = std::move(spawn_result.process);
|
| ASSERT_TRUE(process.IsValid());
|
|
|
| int exit_code = 42;
|
| @@ -249,7 +254,8 @@ TEST_F(ProcessUtilTest, CurrentDirectory) {
|
| TEST_F(ProcessUtilTest, GetProcId) {
|
| base::ProcessId id1 = base::GetProcId(GetCurrentProcess());
|
| EXPECT_NE(0ul, id1);
|
| - base::Process process = SpawnChild("SimpleChildProcess");
|
| + base::SpawnChildResult spawn_result = SpawnChild("SimpleChildProcess");
|
| + base::Process process = std::move(spawn_result.process);
|
| ASSERT_TRUE(process.IsValid());
|
| base::ProcessId id2 = process.Pid();
|
| EXPECT_NE(0ul, id2);
|
| @@ -295,7 +301,8 @@ TEST_F(ProcessUtilTest, MAYBE_GetTerminationStatusCrash) {
|
| const std::string signal_file =
|
| ProcessUtilTest::GetSignalFilePath(kSignalFileCrash);
|
| remove(signal_file.c_str());
|
| - base::Process process = SpawnChild("CrashingChildProcess");
|
| + base::SpawnChildResult spawn_result = SpawnChild("CrashingChildProcess");
|
| + base::Process process = std::move(spawn_result.process);
|
| ASSERT_TRUE(process.IsValid());
|
|
|
| int exit_code = 42;
|
| @@ -350,7 +357,8 @@ TEST_F(ProcessUtilTest, GetTerminationStatusSigKill) {
|
| const std::string signal_file =
|
| ProcessUtilTest::GetSignalFilePath(kSignalFileKill);
|
| remove(signal_file.c_str());
|
| - base::Process process = SpawnChild("KilledChildProcess");
|
| + base::SpawnChildResult spawn_result = SpawnChild("KilledChildProcess");
|
| + base::Process process = std::move(spawn_result.process);
|
| ASSERT_TRUE(process.IsValid());
|
|
|
| int exit_code = 42;
|
| @@ -384,7 +392,8 @@ TEST_F(ProcessUtilTest, GetTerminationStatusSigTerm) {
|
| const std::string signal_file =
|
| ProcessUtilTest::GetSignalFilePath(kSignalFileTerm);
|
| remove(signal_file.c_str());
|
| - base::Process process = SpawnChild("TerminatedChildProcess");
|
| + base::SpawnChildResult spawn_result = SpawnChild("TerminatedChildProcess");
|
| + base::Process process = std::move(spawn_result.process);
|
| ASSERT_TRUE(process.IsValid());
|
|
|
| int exit_code = 42;
|
| @@ -627,8 +636,9 @@ int ProcessUtilTest::CountOpenFDsInChild() {
|
| fd_mapping_vec.push_back(std::pair<int, int>(fds[1], kChildPipe));
|
| base::LaunchOptions options;
|
| options.fds_to_remap = &fd_mapping_vec;
|
| - base::Process process =
|
| + base::SpawnChildResult spawn_result =
|
| SpawnChildWithOptions("ProcessUtilsLeakFDChildProcess", options);
|
| + base::Process process = std::move(spawn_result.process);
|
| CHECK(process.IsValid());
|
| int ret = IGNORE_EINTR(close(fds[1]));
|
| DPCHECK(ret == 0);
|
| @@ -869,7 +879,9 @@ bool IsProcessDead(base::ProcessHandle child) {
|
| }
|
|
|
| TEST_F(ProcessUtilTest, DelayedTermination) {
|
| - base::Process child_process = SpawnChild("process_util_test_never_die");
|
| + base::SpawnChildResult spawn_result =
|
| + SpawnChild("process_util_test_never_die");
|
| + base::Process child_process = std::move(spawn_result.process);
|
| ASSERT_TRUE(child_process.IsValid());
|
| base::EnsureProcessTerminated(child_process.Duplicate());
|
| int exit_code;
|
| @@ -888,7 +900,9 @@ MULTIPROCESS_TEST_MAIN(process_util_test_never_die) {
|
| }
|
|
|
| TEST_F(ProcessUtilTest, ImmediateTermination) {
|
| - base::Process child_process = SpawnChild("process_util_test_die_immediately");
|
| + base::SpawnChildResult spawn_result =
|
| + SpawnChild("process_util_test_die_immediately");
|
| + base::Process child_process = std::move(spawn_result.process);
|
| ASSERT_TRUE(child_process.IsValid());
|
| // Give it time to die.
|
| sleep(2);
|
| @@ -934,7 +948,9 @@ TEST_F(ProcessUtilTest, PreExecHook) {
|
| base::LaunchOptions options;
|
| options.fds_to_remap = &fds_to_remap;
|
| options.pre_exec_delegate = &read_from_pipe_delegate;
|
| - base::Process process(SpawnChildWithOptions("SimpleChildProcess", options));
|
| + base::SpawnChildResult spawn_result =
|
| + SpawnChildWithOptions("SimpleChildProcess", options);
|
| + base::Process process(std::move(spawn_result.process));
|
| ASSERT_TRUE(process.IsValid());
|
|
|
| read_fd.reset();
|
| @@ -969,7 +985,9 @@ TEST_F(ProcessUtilTest, CloneFlags) {
|
| base::LaunchOptions options;
|
| options.clone_flags = CLONE_NEWUSER | CLONE_NEWPID;
|
|
|
| - base::Process process(SpawnChildWithOptions("CheckPidProcess", options));
|
| + base::SpawnChildResult spawn_result =
|
| + SpawnChildWithOptions("CheckPidProcess", options);
|
| + base::Process process = std::move(spawn_result.process);
|
| ASSERT_TRUE(process.IsValid());
|
|
|
| int exit_code = 42;
|
| @@ -1010,7 +1028,9 @@ TEST_F(ProcessUtilTest, InvalidCurrentDirectory) {
|
| base::LaunchOptions options;
|
| options.current_directory = base::FilePath("/dev/null");
|
|
|
| - base::Process process(SpawnChildWithOptions("SimpleChildProcess", options));
|
| + base::SpawnChildResult spawn_result =
|
| + SpawnChildWithOptions("SimpleChildProcess", options);
|
| + base::Process process = std::move(spawn_result.process);
|
| ASSERT_TRUE(process.IsValid());
|
|
|
| int exit_code = kSuccess;
|
|
|