#include "base/logging.h"
#include "base/process/kill.h"
#include "base/process/process_handle.h"
-// TODO(vtl): Remove build_config.h include when fully implemented on Windows.
#include "build/build_config.h"
#include "mojo/system/embedder/platform_channel_pair.h"
MultiProcessTest::SetUp();
-// TODO(vtl): Not implemented on Windows yet.
-#if defined(OS_POSIX)
platform_channel_pair_.reset(new embedder::PlatformChannelPair());
server_platform_handle = platform_channel_pair_->PassServerHandle();
-#endif
}
void MultiprocessTestBase::TearDown() {
std::string test_child_main = test_child_name + "TestChildMain";
-#if defined(OS_POSIX)
CommandLine unused(CommandLine::NO_PROGRAM);
- base::FileHandleMappingVector fds_to_map;
- platform_channel_pair_->PrepareToPassClientHandleToChildProcess(&unused,
- &fds_to_map);
- test_child_handle_ = SpawnChild(test_child_main, fds_to_map, false);
+ embedder::HandlePassingInformation handle_passing_info;
+ platform_channel_pair_->PrepareToPassClientHandleToChildProcess(
+ &unused, &handle_passing_info);
+
+ base::LaunchOptions options;
+#if defined(OS_POSIX)
+ options.fds_to_remap = &handle_passing_info;
#elif defined(OS_WIN)
- test_child_handle_ = SpawnChild(test_child_main, false);
+ options.start_hidden = true;
+ options.handles_to_inherit = &handle_passing_info;
#else
#error "Not supported yet."
#endif
-// TODO(vtl): Not implemented on Windows yet.
-#if defined(OS_POSIX)
+
+ test_child_handle_ = SpawnChildWithOptions(test_child_main, options, false);
platform_channel_pair_->ChildProcessLaunched();
-#endif
CHECK_NE(test_child_handle_, base::kNullProcessHandle);
}
CommandLine command_line =
base::MultiProcessTest::MakeCmdLine(procname, debug_on_start);
-// TODO(vtl): Not implemented on Windows yet.
-#if defined(OS_POSIX)
- base::FileHandleMappingVector unused;
+ embedder::HandlePassingInformation unused;
platform_channel_pair_->PrepareToPassClientHandleToChildProcess(&command_line,
&unused);
-#endif
+
return command_line;
}
// static
void MultiprocessTestBase::ChildSetup() {
CHECK(CommandLine::InitializedForCurrentProcess());
-// TODO(vtl): Not implemented on Windows yet.
-#if defined(OS_POSIX)
client_platform_handle =
embedder::PlatformChannelPair::PassClientHandleFromParentProcess(
*CommandLine::ForCurrentProcess());
-#endif
}
// static