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

Unified Diff: sandbox/mac/bootstrap_sandbox_unittest.mm

Issue 843113003: MultiProcessTest: Update SpawnChild* to return a Process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « mojo/edk/test/multiprocess_test_helper.cc ('k') | sandbox/mac/xpc_message_server_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/mac/bootstrap_sandbox_unittest.mm
diff --git a/sandbox/mac/bootstrap_sandbox_unittest.mm b/sandbox/mac/bootstrap_sandbox_unittest.mm
index 5621211a342a4cbdbd922ec76d37045fafc4df93..f8851e9c8d74c583f5ed0318ab9c5c7c13a667fd 100644
--- a/sandbox/mac/bootstrap_sandbox_unittest.mm
+++ b/sandbox/mac/bootstrap_sandbox_unittest.mm
@@ -100,14 +100,14 @@ class BootstrapSandboxTest : public base::MultiProcessTest {
sandbox_->PrepareToForkWithPolicy(policy_id);
base::LaunchOptions options;
options.replacement_bootstrap_name = sandbox_->server_bootstrap_name();
- base::ProcessHandle pid = SpawnChildWithOptions(child_name, options);
- ASSERT_GT(pid, 0);
- sandbox_->FinishedFork(pid);
+ base::Process process = SpawnChildWithOptions(child_name, options);
+ ASSERT_TRUE(process.IsValid());
+ sandbox_->FinishedFork(process.Handle());
int code = 0;
- EXPECT_TRUE(base::WaitForExitCode(pid, &code));
+ EXPECT_TRUE(process.WaitForExit(&code));
EXPECT_EQ(0, code);
if (out_pid)
- *out_pid = pid;
+ *out_pid = process.pid();
}
protected:
@@ -121,15 +121,15 @@ TEST_F(BootstrapSandboxTest, DistributedNotifications_Unsandboxed) {
base::scoped_nsobject<DistributedNotificationObserver> observer(
[[DistributedNotificationObserver alloc] init]);
- base::ProcessHandle pid = SpawnChild(kNotificationTestMain);
- ASSERT_GT(pid, 0);
+ base::Process process = SpawnChild(kNotificationTestMain);
+ ASSERT_TRUE(process.IsValid());
int code = 0;
- EXPECT_TRUE(base::WaitForExitCode(pid, &code));
+ EXPECT_TRUE(process.WaitForExit(&code));
EXPECT_EQ(0, code);
[observer waitForNotification];
EXPECT_EQ(1, [observer receivedCount]);
- EXPECT_EQ(pid, [[observer object] intValue]);
+ EXPECT_EQ(process.pid(), [[observer object] intValue]);
}
// Run the test with the sandbox enabled without notifications on the policy
@@ -439,10 +439,9 @@ TEST_F(BootstrapSandboxTest, ChildOutliveSandbox) {
sandbox_->PrepareToForkWithPolicy(kTestPolicyId);
base::LaunchOptions options;
options.replacement_bootstrap_name = sandbox_->server_bootstrap_name();
- base::ProcessHandle pid =
- SpawnChildWithOptions("ChildOutliveSandbox", options);
- ASSERT_GT(pid, 0);
- sandbox_->FinishedFork(pid);
+ base::Process process = SpawnChildWithOptions("ChildOutliveSandbox", options);
+ ASSERT_TRUE(process.IsValid());
+ sandbox_->FinishedFork(process.Handle());
// Synchronize with the child.
mach_msg_empty_rcv_t rcv_msg;
@@ -468,7 +467,7 @@ TEST_F(BootstrapSandboxTest, ChildOutliveSandbox) {
EXPECT_EQ(KERN_SUCCESS, kr) << mach_error_string(kr);
int code = 0;
- EXPECT_TRUE(base::WaitForExitCode(pid, &code));
+ EXPECT_TRUE(process.WaitForExit(&code));
EXPECT_EQ(0, code);
}
« no previous file with comments | « mojo/edk/test/multiprocess_test_helper.cc ('k') | sandbox/mac/xpc_message_server_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698