Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Unified Diff: services/service_manager/tests/service_manager/service_manager_unittest.cc

Issue 2950153002: Improve process launch handle sharing API. (Closed)
Patch Set: Fix Mojo launcher, review comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: services/service_manager/tests/service_manager/service_manager_unittest.cc
diff --git a/services/service_manager/tests/service_manager/service_manager_unittest.cc b/services/service_manager/tests/service_manager/service_manager_unittest.cc
index 5d0d229e76b84ca8beaa817590e5a604bd3b29de..78b2272120bb0fba9db8fc67af3e557e94a59bd6 100644
--- a/services/service_manager/tests/service_manager/service_manager_unittest.cc
+++ b/services/service_manager/tests/service_manager/service_manager_unittest.cc
@@ -19,6 +19,7 @@
#include "base/process/process.h"
#include "base/process/process_handle.h"
#include "base/run_loop.h"
+#include "build/build_config.h"
#include "mojo/edk/embedder/embedder.h"
#include "mojo/edk/embedder/outgoing_broker_client_invitation.h"
#include "mojo/edk/embedder/platform_channel_pair.h"
@@ -176,9 +177,14 @@ class ServiceManagerTest : public test::ServiceTest,
// Create the channel to be shared with the target process. Pass one end
// on the command line.
mojo::edk::PlatformChannelPair platform_channel_pair;
- mojo::edk::HandlePassingInformation handle_passing_info;
+ base::LaunchOptions options;
+#if defined(OS_WIN)
+ platform_channel_pair.PrepareToPassClientHandleToChildProcess(
+ &child_command_line, &options.handles_to_inherit);
+#else
platform_channel_pair.PrepareToPassClientHandleToChildProcess(
- &child_command_line, &handle_passing_info);
+ &child_command_line, &options.fds_to_remap);
+#endif
mojo::edk::OutgoingBrokerClientInvitation invitation;
service_manager::mojom::ServicePtr client =
@@ -194,12 +200,6 @@ class ServiceManagerTest : public test::ServiceTest,
test_api.SetStartServiceCallback(base::Bind(
&ServiceManagerTest::OnConnectionCompleted, base::Unretained(this)));
- base::LaunchOptions options;
-#if defined(OS_WIN)
- options.handles_to_inherit = &handle_passing_info;
-#elif defined(OS_POSIX)
- options.fds_to_remap = &handle_passing_info;
-#endif
target_ = base::LaunchProcess(child_command_line, options);
DCHECK(target_.IsValid());
receiver->SetPID(target_.Pid());

Powered by Google App Engine
This is Rietveld 408576698