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