Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / mojo / common / test / multiprocess_test_base.cc
index 7785b93..028990e 100644 (file)
@@ -8,7 +8,6 @@
 #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"
 
@@ -28,11 +27,8 @@ void MultiprocessTestBase::SetUp() {
 
   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() {
@@ -51,21 +47,23 @@ void MultiprocessTestBase::StartChild(const std::string& test_child_name) {
 
   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);
 }
@@ -88,24 +86,19 @@ CommandLine MultiprocessTestBase::MakeCmdLine(const std::string& procname,
 
   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