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

Unified Diff: mojo/edk/test/multiprocess_test_helper.cc

Issue 1485573002: Remove SimpleBroker and instead use the production broker implementation in tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment Created 5 years, 1 month 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
« no previous file with comments | « mojo/edk/test/multiprocess_test_helper.h ('k') | mojo/mojo_edk.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b07866ef445e7617f22cfa9a3dca02fae03f50bf..d82cbafb0a6d9e2c20eb093983a44d30171eef87 100644
--- a/mojo/edk/test/multiprocess_test_helper.cc
+++ b/mojo/edk/test/multiprocess_test_helper.cc
@@ -9,6 +9,7 @@
#include "base/process/kill.h"
#include "base/process/process_handle.h"
#include "build/build_config.h"
+#include "mojo/edk/embedder/embedder.h"
#include "mojo/edk/embedder/platform_channel_pair.h"
#if defined(OS_WIN)
@@ -19,9 +20,12 @@ namespace mojo {
namespace edk {
namespace test {
+const char kBrokerHandleSwitch[] = "broker-handle";
+
MultiprocessTestHelper::MultiprocessTestHelper() {
platform_channel_pair_.reset(new PlatformChannelPair());
server_platform_handle = platform_channel_pair_->PassServerHandle();
+ broker_platform_channel_pair_.reset(new PlatformChannelPair());
}
MultiprocessTestHelper::~MultiprocessTestHelper() {
@@ -50,6 +54,10 @@ void MultiprocessTestHelper::StartChildWithExtraSwitch(
platform_channel_pair_->PrepareToPassClientHandleToChildProcess(
&command_line, &handle_passing_info);
+ std::string broker_handle = broker_platform_channel_pair_->
+ PrepareToPassClientHandleToChildProcessAsString(&handle_passing_info);
+ command_line.AppendSwitchASCII(kBrokerHandleSwitch, broker_handle);
+
if (!switch_string.empty()) {
CHECK(!command_line.HasSwitch(switch_string));
if (!switch_value.empty())
@@ -75,6 +83,10 @@ void MultiprocessTestHelper::StartChildWithExtraSwitch(
base::SpawnMultiProcessTestChild(test_child_main, command_line, options);
platform_channel_pair_->ChildProcessLaunched();
+ broker_platform_channel_pair_->ChildProcessLaunched();
+ ChildProcessLaunched(test_child_.Handle(),
+ broker_platform_channel_pair_->PassServerHandle());
+
CHECK(test_child_.IsValid());
}
@@ -98,6 +110,14 @@ void MultiprocessTestHelper::ChildSetup() {
client_platform_handle =
PlatformChannelPair::PassClientHandleFromParentProcess(
*base::CommandLine::ForCurrentProcess());
+
+ std::string broker_handle_str =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ kBrokerHandleSwitch);
+ ScopedPlatformHandle broker_handle =
+ PlatformChannelPair::PassClientHandleFromParentProcessFromString(
+ broker_handle_str);
+ SetParentPipeHandle(broker_handle.Pass());
}
// static
« no previous file with comments | « mojo/edk/test/multiprocess_test_helper.h ('k') | mojo/mojo_edk.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698