MultiProcessTest: Update SpawnChild* to return a Process.

We should not be dealing with raw handles.

BUG=417532

Review URL: https://codereview.chromium.org/843113003

Cr-Commit-Position: refs/heads/master@{#311127}


CrOS-Libchrome-Original-Commit: 07b589c1f6c4d0aac24e270a13fa83031bf2038c
diff --git a/ipc/ipc_channel_posix_unittest.cc b/ipc/ipc_channel_posix_unittest.cc
index a01710c..93fc13c 100644
--- a/ipc/ipc_channel_posix_unittest.cc
+++ b/ipc/ipc_channel_posix_unittest.cc
@@ -293,8 +293,8 @@
   ASSERT_TRUE(channel->AcceptsConnections());
   ASSERT_FALSE(channel->HasAcceptedConnection());
 
-  base::ProcessHandle handle = SpawnChild("IPCChannelPosixTestConnectionProc");
-  ASSERT_TRUE(handle);
+  base::Process process = SpawnChild("IPCChannelPosixTestConnectionProc");
+  ASSERT_TRUE(process.IsValid());
   SpinRunLoop(TestTimeouts::action_max_timeout());
   ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status());
   ASSERT_TRUE(channel->HasAcceptedConnection());
@@ -304,7 +304,7 @@
   channel->Send(message);
   SpinRunLoop(TestTimeouts::action_timeout());
   int exit_code = 0;
-  EXPECT_TRUE(base::WaitForExitCode(handle, &exit_code));
+  EXPECT_TRUE(process.WaitForExit(&exit_code));
   EXPECT_EQ(0, exit_code);
   ASSERT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status());
   ASSERT_FALSE(channel->HasAcceptedConnection());
@@ -323,16 +323,16 @@
   ASSERT_TRUE(channel->AcceptsConnections());
   ASSERT_FALSE(channel->HasAcceptedConnection());
 
-  base::ProcessHandle handle = SpawnChild("IPCChannelPosixTestConnectionProc");
-  ASSERT_TRUE(handle);
+  base::Process process = SpawnChild("IPCChannelPosixTestConnectionProc");
+  ASSERT_TRUE(process.IsValid());
   SpinRunLoop(TestTimeouts::action_max_timeout());
   ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status());
   ASSERT_TRUE(channel->HasAcceptedConnection());
   channel->ResetToAcceptingConnectionState();
   ASSERT_FALSE(channel->HasAcceptedConnection());
 
-  base::ProcessHandle handle2 = SpawnChild("IPCChannelPosixTestConnectionProc");
-  ASSERT_TRUE(handle2);
+  base::Process process2 = SpawnChild("IPCChannelPosixTestConnectionProc");
+  ASSERT_TRUE(process2.IsValid());
   SpinRunLoop(TestTimeouts::action_max_timeout());
   ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status());
   ASSERT_TRUE(channel->HasAcceptedConnection());
@@ -341,9 +341,9 @@
                                            IPC::Message::PRIORITY_NORMAL);
   channel->Send(message);
   SpinRunLoop(TestTimeouts::action_timeout());
-  EXPECT_TRUE(base::KillProcess(handle, 0, false));
+  EXPECT_TRUE(base::KillProcess(process.Handle(), 0, false));
   int exit_code = 0;
-  EXPECT_TRUE(base::WaitForExitCode(handle2, &exit_code));
+  EXPECT_TRUE(process2.WaitForExit(&exit_code));
   EXPECT_EQ(0, exit_code);
   ASSERT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status());
   ASSERT_FALSE(channel->HasAcceptedConnection());
@@ -383,16 +383,16 @@
   ASSERT_TRUE(channel->AcceptsConnections());
   ASSERT_FALSE(channel->HasAcceptedConnection());
 
-  base::ProcessHandle handle = SpawnChild("IPCChannelPosixTestConnectionProc");
-  ASSERT_TRUE(handle);
+  base::Process process = SpawnChild("IPCChannelPosixTestConnectionProc");
+  ASSERT_TRUE(process.IsValid());
   SpinRunLoop(TestTimeouts::action_max_timeout());
   ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status());
   ASSERT_TRUE(channel->HasAcceptedConnection());
-  base::ProcessHandle handle2 = SpawnChild("IPCChannelPosixFailConnectionProc");
-  ASSERT_TRUE(handle2);
+  base::Process process2 = SpawnChild("IPCChannelPosixFailConnectionProc");
+  ASSERT_TRUE(process2.IsValid());
   SpinRunLoop(TestTimeouts::action_max_timeout());
   int exit_code = 0;
-  EXPECT_TRUE(base::WaitForExitCode(handle2, &exit_code));
+  EXPECT_TRUE(process2.WaitForExit(&exit_code));
   EXPECT_EQ(exit_code, 0);
   ASSERT_EQ(IPCChannelPosixTestListener::DENIED, listener.status());
   ASSERT_TRUE(channel->HasAcceptedConnection());
@@ -401,7 +401,7 @@
                                            IPC::Message::PRIORITY_NORMAL);
   channel->Send(message);
   SpinRunLoop(TestTimeouts::action_timeout());
-  EXPECT_TRUE(base::WaitForExitCode(handle, &exit_code));
+  EXPECT_TRUE(process.WaitForExit(&exit_code));
   EXPECT_EQ(exit_code, 0);
   ASSERT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status());
   ASSERT_FALSE(channel->HasAcceptedConnection());