OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "content/browser/mach_broker_mac.h" | 5 #include "content/browser/mach_broker_mac.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/synchronization/lock.h" | 8 #include "base/synchronization/lock.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/test/multiprocess_test.h" | 10 #include "base/test/multiprocess_test.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 broker_.InvalidateChildProcessId(child_process_id); | 38 broker_.InvalidateChildProcessId(child_process_id); |
39 } | 39 } |
40 | 40 |
41 int GetChildProcessCount(int child_process_id) { | 41 int GetChildProcessCount(int child_process_id) { |
42 return broker_.child_process_id_map_.count(child_process_id); | 42 return broker_.child_process_id_map_.count(child_process_id); |
43 } | 43 } |
44 | 44 |
45 base::Process LaunchTestChild(const std::string& function, | 45 base::Process LaunchTestChild(const std::string& function, |
46 int child_process_id) { | 46 int child_process_id) { |
47 base::AutoLock lock(broker_.GetLock()); | 47 base::AutoLock lock(broker_.GetLock()); |
48 base::Process test_child_process = base::SpawnMultiProcessTestChild( | 48 base::SpawnChildResult spaw_result = base::SpawnMultiProcessTestChild( |
49 function, base::GetMultiProcessTestChildBaseCommandLine(), | 49 function, base::GetMultiProcessTestChildBaseCommandLine(), |
50 base::LaunchOptions()); | 50 base::LaunchOptions()); |
| 51 base::Process test_child_process = std::move(spaw_result.process); |
51 broker_.AddPlaceholderForPid(test_child_process.Handle(), child_process_id); | 52 broker_.AddPlaceholderForPid(test_child_process.Handle(), child_process_id); |
52 return test_child_process; | 53 return test_child_process; |
53 } | 54 } |
54 | 55 |
55 void WaitForChildExit(base::Process& process) { | 56 void WaitForChildExit(base::Process& process) { |
56 int rv = -1; | 57 int rv = -1; |
57 ASSERT_TRUE(process.WaitForExitWithTimeout( | 58 ASSERT_TRUE(process.WaitForExitWithTimeout( |
58 TestTimeouts::action_timeout(), &rv)); | 59 TestTimeouts::action_timeout(), &rv)); |
59 EXPECT_EQ(0, rv); | 60 EXPECT_EQ(0, rv); |
60 } | 61 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 EXPECT_EQ(static_cast<mach_port_t>(MACH_PORT_NULL), | 105 EXPECT_EQ(static_cast<mach_port_t>(MACH_PORT_NULL), |
105 broker_.TaskForPid(child_process.Handle() + 1)); | 106 broker_.TaskForPid(child_process.Handle() + 1)); |
106 | 107 |
107 InvalidateChildProcessId(7); | 108 InvalidateChildProcessId(7); |
108 EXPECT_EQ(static_cast<mach_port_t>(MACH_PORT_NULL), | 109 EXPECT_EQ(static_cast<mach_port_t>(MACH_PORT_NULL), |
109 broker_.TaskForPid(child_process.Handle())); | 110 broker_.TaskForPid(child_process.Handle())); |
110 EXPECT_EQ(0, GetChildProcessCount(7)); | 111 EXPECT_EQ(0, GetChildProcessCount(7)); |
111 } | 112 } |
112 | 113 |
113 } // namespace content | 114 } // namespace content |
OLD | NEW |