| Index: mojo/edk/test/multiprocess_test_helper.cc
|
| diff --git a/mojo/edk/test/multiprocess_test_helper.cc b/mojo/edk/test/multiprocess_test_helper.cc
|
| index 4bc550f505e2424f62229ace819c41d4dd4932e8..cf377827f577edc08f2c210a1e859bc27f610a9e 100644
|
| --- a/mojo/edk/test/multiprocess_test_helper.cc
|
| +++ b/mojo/edk/test/multiprocess_test_helper.cc
|
| @@ -46,11 +46,13 @@ const char kMojoPrimordialPipeToken[] = "mojo-primordial-pipe-token";
|
| const char kMojoNamedPipeName[] = "mojo-named-pipe-name";
|
|
|
| template <typename Func>
|
| -int RunClientFunction(Func handler) {
|
| +int RunClientFunction(Func handler, bool pass_pipe_ownership_to_main) {
|
| CHECK(MultiprocessTestHelper::primordial_pipe.is_valid());
|
| ScopedMessagePipeHandle pipe =
|
| std::move(MultiprocessTestHelper::primordial_pipe);
|
| - return handler(pipe.get().value());
|
| + MessagePipeHandle pipe_handle =
|
| + pass_pipe_ownership_to_main ? pipe.release() : pipe.get();
|
| + return handler(pipe_handle.value());
|
| }
|
|
|
| } // namespace
|
| @@ -232,20 +234,25 @@ void MultiprocessTestHelper::ChildSetup() {
|
|
|
| // static
|
| int MultiprocessTestHelper::RunClientMain(
|
| - const base::Callback<int(MojoHandle)>& main) {
|
| - return RunClientFunction([main](MojoHandle handle){
|
| - return main.Run(handle);
|
| - });
|
| + const base::Callback<int(MojoHandle)>& main,
|
| + bool pass_pipe_ownership_to_main) {
|
| + return RunClientFunction(
|
| + [main](MojoHandle handle) { return main.Run(handle); },
|
| + pass_pipe_ownership_to_main);
|
| }
|
|
|
| // static
|
| int MultiprocessTestHelper::RunClientTestMain(
|
| const base::Callback<void(MojoHandle)>& main) {
|
| - return RunClientFunction([main](MojoHandle handle) {
|
| - main.Run(handle);
|
| - return (::testing::Test::HasFatalFailure() ||
|
| - ::testing::Test::HasNonfatalFailure()) ? 1 : 0;
|
| - });
|
| + return RunClientFunction(
|
| + [main](MojoHandle handle) {
|
| + main.Run(handle);
|
| + return (::testing::Test::HasFatalFailure() ||
|
| + ::testing::Test::HasNonfatalFailure())
|
| + ? 1
|
| + : 0;
|
| + },
|
| + true /* close_pipe_on_exit */);
|
| }
|
|
|
| // static
|
|
|