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

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

Issue 621153003: Move mojo edk into mojo/edk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix checkdeps Created 6 years, 2 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
« no previous file with comments | « mojo/common/test/multiprocess_test_helper.h ('k') | mojo/common/test/multiprocess_test_helper_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/common/test/multiprocess_test_helper.cc
diff --git a/mojo/common/test/multiprocess_test_helper.cc b/mojo/common/test/multiprocess_test_helper.cc
deleted file mode 100644
index 7e9df3e5b514544598ad4ccec8ec7e91e3e58fc9..0000000000000000000000000000000000000000
--- a/mojo/common/test/multiprocess_test_helper.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// 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_helper.h"
-
-#include "base/command_line.h"
-#include "base/logging.h"
-#include "base/process/kill.h"
-#include "base/process/process_handle.h"
-#include "build/build_config.h"
-#include "mojo/embedder/platform_channel_pair.h"
-
-namespace mojo {
-namespace test {
-
-MultiprocessTestHelper::MultiprocessTestHelper()
- : test_child_handle_(base::kNullProcessHandle) {
- platform_channel_pair_.reset(new embedder::PlatformChannelPair());
- server_platform_handle = platform_channel_pair_->PassServerHandle();
-}
-
-MultiprocessTestHelper::~MultiprocessTestHelper() {
- CHECK_EQ(test_child_handle_, base::kNullProcessHandle);
- server_platform_handle.reset();
- platform_channel_pair_.reset();
-}
-
-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";
-
- base::CommandLine command_line(
- base::GetMultiProcessTestChildBaseCommandLine());
- embedder::HandlePassingInformation handle_passing_info;
- platform_channel_pair_->PrepareToPassClientHandleToChildProcess(
- &command_line, &handle_passing_info);
-
- base::LaunchOptions options;
-#if defined(OS_POSIX)
- options.fds_to_remap = &handle_passing_info;
-#elif defined(OS_WIN)
- options.start_hidden = true;
- options.handles_to_inherit = &handle_passing_info;
-#else
-#error "Not supported yet."
-#endif
-
- test_child_handle_ =
- base::SpawnMultiProcessTestChild(test_child_main, command_line, options);
- platform_channel_pair_->ChildProcessLaunched();
-
- CHECK_NE(test_child_handle_, base::kNullProcessHandle);
-}
-
-int MultiprocessTestHelper::WaitForChildShutdown() {
- CHECK_NE(test_child_handle_, base::kNullProcessHandle);
-
- int rv = -1;
- CHECK(base::WaitForExitCodeWithTimeout(
- test_child_handle_, &rv, TestTimeouts::action_timeout()));
- base::CloseProcessHandle(test_child_handle_);
- test_child_handle_ = base::kNullProcessHandle;
- return rv;
-}
-
-bool MultiprocessTestHelper::WaitForChildTestShutdown() {
- return WaitForChildShutdown() == 0;
-}
-
-// static
-void MultiprocessTestHelper::ChildSetup() {
- CHECK(base::CommandLine::InitializedForCurrentProcess());
- client_platform_handle =
- embedder::PlatformChannelPair::PassClientHandleFromParentProcess(
- *base::CommandLine::ForCurrentProcess());
-}
-
-// static
-embedder::ScopedPlatformHandle MultiprocessTestHelper::client_platform_handle;
-
-} // namespace test
-} // namespace mojo
« no previous file with comments | « mojo/common/test/multiprocess_test_helper.h ('k') | mojo/common/test/multiprocess_test_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698