OLD | NEW |
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 | 10 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 base::Process child = base::SpawnMultiProcessTestChild( | 152 base::Process child = base::SpawnMultiProcessTestChild( |
153 "GetSenderPID", | 153 "GetSenderPID", |
154 base::GetMultiProcessTestChildBaseCommandLine(), | 154 base::GetMultiProcessTestChildBaseCommandLine(), |
155 base::LaunchOptions()); | 155 base::LaunchOptions()); |
156 ASSERT_TRUE(child.IsValid()); | 156 ASSERT_TRUE(child.IsValid()); |
157 | 157 |
158 int exit_code = -1; | 158 int exit_code = -1; |
159 ASSERT_TRUE(child.WaitForExit(&exit_code)); | 159 ASSERT_TRUE(child.WaitForExit(&exit_code)); |
160 EXPECT_EQ(0, exit_code); | 160 EXPECT_EQ(0, exit_code); |
161 | 161 |
162 EXPECT_EQ(child.pid(), sender_pid); | 162 EXPECT_EQ(child.Pid(), sender_pid); |
163 EXPECT_EQ(child.pid(), child_pid); | 163 EXPECT_EQ(child.Pid(), child_pid); |
164 EXPECT_EQ(sender_pid, child_pid); | 164 EXPECT_EQ(sender_pid, child_pid); |
165 } | 165 } |
166 | 166 |
167 MULTIPROCESS_TEST_MAIN(GetSenderPID) { | 167 MULTIPROCESS_TEST_MAIN(GetSenderPID) { |
168 CHECK(sandbox::InitializeXPC()); | 168 CHECK(sandbox::InitializeXPC()); |
169 | 169 |
170 mach_port_t port = MACH_PORT_NULL; | 170 mach_port_t port = MACH_PORT_NULL; |
171 CHECK_EQ(KERN_SUCCESS, bootstrap_look_up(bootstrap_port, kGetSenderPID, | 171 CHECK_EQ(KERN_SUCCESS, bootstrap_look_up(bootstrap_port, kGetSenderPID, |
172 &port)); | 172 &port)); |
173 base::mac::ScopedMachSendRight scoped_port(port); | 173 base::mac::ScopedMachSendRight scoped_port(port); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 ASSERT_EQ(0, xpc_pipe_routine(first.pipe(), request, &reply)); | 208 ASSERT_EQ(0, xpc_pipe_routine(first.pipe(), request, &reply)); |
209 | 209 |
210 EXPECT_EQ(1, xpc_dictionary_get_int64(reply, "seen_by_first")); | 210 EXPECT_EQ(1, xpc_dictionary_get_int64(reply, "seen_by_first")); |
211 EXPECT_EQ(2, xpc_dictionary_get_int64(reply, "seen_by_second")); | 211 EXPECT_EQ(2, xpc_dictionary_get_int64(reply, "seen_by_second")); |
212 | 212 |
213 xpc_release(request); | 213 xpc_release(request); |
214 xpc_release(reply); | 214 xpc_release(reply); |
215 } | 215 } |
216 | 216 |
217 } // namespace sandbox | 217 } // namespace sandbox |
OLD | NEW |