| Index: mojo/common/test/multiprocess_test_helper.cc
|
| diff --git a/mojo/common/test/multiprocess_test_base.cc b/mojo/common/test/multiprocess_test_helper.cc
|
| similarity index 57%
|
| rename from mojo/common/test/multiprocess_test_base.cc
|
| rename to mojo/common/test/multiprocess_test_helper.cc
|
| index 028990ed81141671d2eeb3197519ae0e785e410d..c3ae63d6a8010c963292f0060b019bb079e66e19 100644
|
| --- a/mojo/common/test/multiprocess_test_base.cc
|
| +++ b/mojo/common/test/multiprocess_test_helper.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "mojo/common/test/multiprocess_test_base.h"
|
| +#include "mojo/common/test/multiprocess_test_helper.h"
|
|
|
| #include "base/command_line.h"
|
| #include "base/logging.h"
|
| @@ -14,43 +14,29 @@
|
| namespace mojo {
|
| namespace test {
|
|
|
| -MultiprocessTestBase::MultiprocessTestBase()
|
| +MultiprocessTestHelper::MultiprocessTestHelper()
|
| : test_child_handle_(base::kNullProcessHandle) {
|
| -}
|
| -
|
| -MultiprocessTestBase::~MultiprocessTestBase() {
|
| - CHECK_EQ(test_child_handle_, base::kNullProcessHandle);
|
| -}
|
| -
|
| -void MultiprocessTestBase::SetUp() {
|
| - CHECK_EQ(test_child_handle_, base::kNullProcessHandle);
|
| -
|
| - MultiProcessTest::SetUp();
|
| -
|
| platform_channel_pair_.reset(new embedder::PlatformChannelPair());
|
| server_platform_handle = platform_channel_pair_->PassServerHandle();
|
| }
|
|
|
| -void MultiprocessTestBase::TearDown() {
|
| +MultiprocessTestHelper::~MultiprocessTestHelper() {
|
| CHECK_EQ(test_child_handle_, base::kNullProcessHandle);
|
| -
|
| server_platform_handle.reset();
|
| platform_channel_pair_.reset();
|
| -
|
| - MultiProcessTest::TearDown();
|
| }
|
|
|
| -void MultiprocessTestBase::StartChild(const std::string& test_child_name) {
|
| +void MultiprocessTestHelper::StartChild(const std::string& test_child_name) {
|
| CHECK(platform_channel_pair_.get());
|
| CHECK(!test_child_name.empty());
|
| CHECK_EQ(test_child_handle_, base::kNullProcessHandle);
|
|
|
| std::string test_child_main = test_child_name + "TestChildMain";
|
|
|
| - CommandLine unused(CommandLine::NO_PROGRAM);
|
| + CommandLine command_line(base::GetMultiProcessTestChildBaseCommandLine());
|
| embedder::HandlePassingInformation handle_passing_info;
|
| platform_channel_pair_->PrepareToPassClientHandleToChildProcess(
|
| - &unused, &handle_passing_info);
|
| + &command_line, &handle_passing_info);
|
|
|
| base::LaunchOptions options;
|
| #if defined(OS_POSIX)
|
| @@ -62,39 +48,26 @@ void MultiprocessTestBase::StartChild(const std::string& test_child_name) {
|
| #error "Not supported yet."
|
| #endif
|
|
|
| - test_child_handle_ = SpawnChildWithOptions(test_child_main, options, false);
|
| + test_child_handle_ = base::SpawnMultiProcessTestChild(
|
| + test_child_main, command_line, options, false);
|
| platform_channel_pair_->ChildProcessLaunched();
|
|
|
| CHECK_NE(test_child_handle_, base::kNullProcessHandle);
|
| }
|
|
|
| -int MultiprocessTestBase::WaitForChildShutdown() {
|
| +int MultiprocessTestHelper::WaitForChildShutdown() {
|
| CHECK_NE(test_child_handle_, base::kNullProcessHandle);
|
|
|
| - static const int kTimeoutSeconds = 5;
|
| int rv = -1;
|
| CHECK(base::WaitForExitCodeWithTimeout(
|
| - test_child_handle_, &rv, base::TimeDelta::FromSeconds(kTimeoutSeconds)));
|
| + test_child_handle_, &rv, TestTimeouts::action_timeout()));
|
| base::CloseProcessHandle(test_child_handle_);
|
| test_child_handle_ = base::kNullProcessHandle;
|
| return rv;
|
| }
|
|
|
| -CommandLine MultiprocessTestBase::MakeCmdLine(const std::string& procname,
|
| - bool debug_on_start) {
|
| - CHECK(platform_channel_pair_.get());
|
| -
|
| - CommandLine command_line =
|
| - base::MultiProcessTest::MakeCmdLine(procname, debug_on_start);
|
| - embedder::HandlePassingInformation unused;
|
| - platform_channel_pair_->PrepareToPassClientHandleToChildProcess(&command_line,
|
| - &unused);
|
| -
|
| - return command_line;
|
| -}
|
| -
|
| // static
|
| -void MultiprocessTestBase::ChildSetup() {
|
| +void MultiprocessTestHelper::ChildSetup() {
|
| CHECK(CommandLine::InitializedForCurrentProcess());
|
| client_platform_handle =
|
| embedder::PlatformChannelPair::PassClientHandleFromParentProcess(
|
| @@ -102,7 +75,7 @@ void MultiprocessTestBase::ChildSetup() {
|
| }
|
|
|
| // static
|
| -embedder::ScopedPlatformHandle MultiprocessTestBase::client_platform_handle;
|
| +embedder::ScopedPlatformHandle MultiprocessTestHelper::client_platform_handle;
|
|
|
| } // namespace test
|
| } // namespace mojo
|
|
|