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

Side by Side Diff: sandbox/mac/xpc_message_server_unittest.cc

Issue 2733323002: Changing multiprocess test SpawnChild to return a struct. (Closed)
Patch Set: Fixed bots. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sandbox/mac/xpc_message_server.h" 5 #include "sandbox/mac/xpc_message_server.h"
6 6
7 #include <Block.h> 7 #include <Block.h>
8 #include <mach/mach.h> 8 #include <mach/mach.h>
9 #include <servers/bootstrap.h> 9 #include <servers/bootstrap.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 child_pid = xpc_dictionary_get_int64(request.xpc, "child_pid"); 140 child_pid = xpc_dictionary_get_int64(request.xpc, "child_pid");
141 })); 141 }));
142 142
143 #pragma GCC diagnostic push 143 #pragma GCC diagnostic push
144 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 144 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
145 kern_return_t kr = bootstrap_register(bootstrap_port, kGetSenderPID, 145 kern_return_t kr = bootstrap_register(bootstrap_port, kGetSenderPID,
146 server->GetServerPort()); 146 server->GetServerPort());
147 #pragma GCC diagnostic pop 147 #pragma GCC diagnostic pop
148 ASSERT_EQ(KERN_SUCCESS, kr); 148 ASSERT_EQ(KERN_SUCCESS, kr);
149 149
150 base::Process child = base::SpawnMultiProcessTestChild( 150 base::SpawnChildResult spawn_result = base::SpawnMultiProcessTestChild(
151 "GetSenderPID", 151 "GetSenderPID", base::GetMultiProcessTestChildBaseCommandLine(),
152 base::GetMultiProcessTestChildBaseCommandLine(),
153 base::LaunchOptions()); 152 base::LaunchOptions());
153 base::Process child = std::move(spawn_result.process);
154 ASSERT_TRUE(child.IsValid()); 154 ASSERT_TRUE(child.IsValid());
155 155
156 int exit_code = -1; 156 int exit_code = -1;
157 ASSERT_TRUE(child.WaitForExit(&exit_code)); 157 ASSERT_TRUE(child.WaitForExit(&exit_code));
158 EXPECT_EQ(0, exit_code); 158 EXPECT_EQ(0, exit_code);
159 159
160 EXPECT_EQ(child.Pid(), sender_pid); 160 EXPECT_EQ(child.Pid(), sender_pid);
161 EXPECT_EQ(child.Pid(), child_pid); 161 EXPECT_EQ(child.Pid(), child_pid);
162 EXPECT_EQ(sender_pid, child_pid); 162 EXPECT_EQ(sender_pid, child_pid);
163 } 163 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 ASSERT_EQ(0, xpc_pipe_routine(first.pipe(), request, &reply)); 204 ASSERT_EQ(0, xpc_pipe_routine(first.pipe(), request, &reply));
205 205
206 EXPECT_EQ(1, xpc_dictionary_get_int64(reply, "seen_by_first")); 206 EXPECT_EQ(1, xpc_dictionary_get_int64(reply, "seen_by_first"));
207 EXPECT_EQ(2, xpc_dictionary_get_int64(reply, "seen_by_second")); 207 EXPECT_EQ(2, xpc_dictionary_get_int64(reply, "seen_by_second"));
208 208
209 xpc_release(request); 209 xpc_release(request);
210 xpc_release(reply); 210 xpc_release(reply);
211 } 211 }
212 212
213 } // namespace sandbox 213 } // namespace sandbox
OLDNEW
« base/debug/stack_trace_unittest.cc ('K') | « sandbox/mac/sandbox_mac_compiler_v2_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698