| 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/edk/test/multiprocess_test_helper.h" | 5 #include "mojo/edk/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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 base::SpawnMultiProcessTestChild(test_child_main, command_line, options); | 53 base::SpawnMultiProcessTestChild(test_child_main, command_line, options); |
| 54 platform_channel_pair_->ChildProcessLaunched(); | 54 platform_channel_pair_->ChildProcessLaunched(); |
| 55 | 55 |
| 56 CHECK_NE(test_child_handle_, base::kNullProcessHandle); | 56 CHECK_NE(test_child_handle_, base::kNullProcessHandle); |
| 57 } | 57 } |
| 58 | 58 |
| 59 int MultiprocessTestHelper::WaitForChildShutdown() { | 59 int MultiprocessTestHelper::WaitForChildShutdown() { |
| 60 CHECK_NE(test_child_handle_, base::kNullProcessHandle); | 60 CHECK_NE(test_child_handle_, base::kNullProcessHandle); |
| 61 | 61 |
| 62 int rv = -1; | 62 int rv = -1; |
| 63 CHECK(base::WaitForExitCodeWithTimeout( | 63 CHECK(base::WaitForExitCodeWithTimeout(test_child_handle_, &rv, |
| 64 test_child_handle_, &rv, TestTimeouts::action_timeout())); | 64 TestTimeouts::action_timeout())); |
| 65 base::CloseProcessHandle(test_child_handle_); | 65 base::CloseProcessHandle(test_child_handle_); |
| 66 test_child_handle_ = base::kNullProcessHandle; | 66 test_child_handle_ = base::kNullProcessHandle; |
| 67 return rv; | 67 return rv; |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool MultiprocessTestHelper::WaitForChildTestShutdown() { | 70 bool MultiprocessTestHelper::WaitForChildTestShutdown() { |
| 71 return WaitForChildShutdown() == 0; | 71 return WaitForChildShutdown() == 0; |
| 72 } | 72 } |
| 73 | 73 |
| 74 // static | 74 // static |
| 75 void MultiprocessTestHelper::ChildSetup() { | 75 void MultiprocessTestHelper::ChildSetup() { |
| 76 CHECK(base::CommandLine::InitializedForCurrentProcess()); | 76 CHECK(base::CommandLine::InitializedForCurrentProcess()); |
| 77 client_platform_handle = | 77 client_platform_handle = |
| 78 embedder::PlatformChannelPair::PassClientHandleFromParentProcess( | 78 embedder::PlatformChannelPair::PassClientHandleFromParentProcess( |
| 79 *base::CommandLine::ForCurrentProcess()); | 79 *base::CommandLine::ForCurrentProcess()); |
| 80 } | 80 } |
| 81 | 81 |
| 82 // static | 82 // static |
| 83 embedder::ScopedPlatformHandle MultiprocessTestHelper::client_platform_handle; | 83 embedder::ScopedPlatformHandle MultiprocessTestHelper::client_platform_handle; |
| 84 | 84 |
| 85 } // namespace test | 85 } // namespace test |
| 86 } // namespace mojo | 86 } // namespace mojo |
| OLD | NEW |