| 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 "build/build_config.h" | |
| 10 #include "mojo/edk/embedder/platform_channel_pair.h" | 9 #include "mojo/edk/embedder/platform_channel_pair.h" |
| 11 | 10 |
| 12 namespace mojo { | 11 namespace mojo { |
| 13 namespace test { | 12 namespace test { |
| 14 | 13 |
| 15 MultiprocessTestHelper::MultiprocessTestHelper() { | 14 MultiprocessTestHelper::MultiprocessTestHelper() { |
| 16 platform_channel_pair_.reset(new embedder::PlatformChannelPair()); | 15 platform_channel_pair_.reset(new embedder::PlatformChannelPair()); |
| 17 server_platform_handle = platform_channel_pair_->PassServerHandle(); | 16 server_platform_handle = platform_channel_pair_->PassServerHandle(); |
| 18 } | 17 } |
| 19 | 18 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 45 | 44 |
| 46 if (!switch_string.empty()) { | 45 if (!switch_string.empty()) { |
| 47 CHECK(!command_line.HasSwitch(switch_string)); | 46 CHECK(!command_line.HasSwitch(switch_string)); |
| 48 if (!switch_value.empty()) | 47 if (!switch_value.empty()) |
| 49 command_line.AppendSwitchASCII(switch_string, switch_value); | 48 command_line.AppendSwitchASCII(switch_string, switch_value); |
| 50 else | 49 else |
| 51 command_line.AppendSwitch(switch_string); | 50 command_line.AppendSwitch(switch_string); |
| 52 } | 51 } |
| 53 | 52 |
| 54 base::LaunchOptions options; | 53 base::LaunchOptions options; |
| 55 #if defined(OS_POSIX) | |
| 56 options.fds_to_remap = &handle_passing_info; | 54 options.fds_to_remap = &handle_passing_info; |
| 57 #elif defined(OS_WIN) | |
| 58 options.start_hidden = true; | |
| 59 options.handles_to_inherit = &handle_passing_info; | |
| 60 #else | |
| 61 #error "Not supported yet." | |
| 62 #endif | |
| 63 | 55 |
| 64 test_child_ = | 56 test_child_ = |
| 65 base::SpawnMultiProcessTestChild(test_child_main, command_line, options); | 57 base::SpawnMultiProcessTestChild(test_child_main, command_line, options); |
| 66 platform_channel_pair_->ChildProcessLaunched(); | 58 platform_channel_pair_->ChildProcessLaunched(); |
| 67 | 59 |
| 68 CHECK(test_child_.IsValid()); | 60 CHECK(test_child_.IsValid()); |
| 69 } | 61 } |
| 70 | 62 |
| 71 int MultiprocessTestHelper::WaitForChildShutdown() { | 63 int MultiprocessTestHelper::WaitForChildShutdown() { |
| 72 CHECK(test_child_.IsValid()); | 64 CHECK(test_child_.IsValid()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 88 client_platform_handle = | 80 client_platform_handle = |
| 89 embedder::PlatformChannelPair::PassClientHandleFromParentProcess( | 81 embedder::PlatformChannelPair::PassClientHandleFromParentProcess( |
| 90 *base::CommandLine::ForCurrentProcess()); | 82 *base::CommandLine::ForCurrentProcess()); |
| 91 } | 83 } |
| 92 | 84 |
| 93 // static | 85 // static |
| 94 embedder::ScopedPlatformHandle MultiprocessTestHelper::client_platform_handle; | 86 embedder::ScopedPlatformHandle MultiprocessTestHelper::client_platform_handle; |
| 95 | 87 |
| 96 } // namespace test | 88 } // namespace test |
| 97 } // namespace mojo | 89 } // namespace mojo |
| OLD | NEW |