OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "mojo/common/test/multiprocess_test_helper.h" | 5 #include "mojo/common/test/multiprocess_test_helper.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/process/kill.h" | 9 #include "base/process/kill.h" |
10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 CHECK_NE(test_child_handle_, base::kNullProcessHandle); | 59 CHECK_NE(test_child_handle_, base::kNullProcessHandle); |
60 | 60 |
61 int rv = -1; | 61 int rv = -1; |
62 CHECK(base::WaitForExitCodeWithTimeout( | 62 CHECK(base::WaitForExitCodeWithTimeout( |
63 test_child_handle_, &rv, TestTimeouts::action_timeout())); | 63 test_child_handle_, &rv, TestTimeouts::action_timeout())); |
64 base::CloseProcessHandle(test_child_handle_); | 64 base::CloseProcessHandle(test_child_handle_); |
65 test_child_handle_ = base::kNullProcessHandle; | 65 test_child_handle_ = base::kNullProcessHandle; |
66 return rv; | 66 return rv; |
67 } | 67 } |
68 | 68 |
| 69 bool MultiprocessTestHelper::WaitForChildTestShutdown() { |
| 70 return WaitForChildShutdown() == 0; |
| 71 } |
| 72 |
69 // static | 73 // static |
70 void MultiprocessTestHelper::ChildSetup() { | 74 void MultiprocessTestHelper::ChildSetup() { |
71 CHECK(CommandLine::InitializedForCurrentProcess()); | 75 CHECK(CommandLine::InitializedForCurrentProcess()); |
72 client_platform_handle = | 76 client_platform_handle = |
73 embedder::PlatformChannelPair::PassClientHandleFromParentProcess( | 77 embedder::PlatformChannelPair::PassClientHandleFromParentProcess( |
74 *CommandLine::ForCurrentProcess()); | 78 *CommandLine::ForCurrentProcess()); |
75 } | 79 } |
76 | 80 |
77 // static | 81 // static |
78 embedder::ScopedPlatformHandle MultiprocessTestHelper::client_platform_handle; | 82 embedder::ScopedPlatformHandle MultiprocessTestHelper::client_platform_handle; |
79 | 83 |
80 } // namespace test | 84 } // namespace test |
81 } // namespace mojo | 85 } // namespace mojo |
OLD | NEW |