| 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 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |