diff options
author | rvargas <rvargas@chromium.org> | 2015-01-12 14:23:23 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-12 22:25:04 +0000 |
commit | 07b589c1f6c4d0aac24e270a13fa83031bf2038c (patch) | |
tree | 18a5284042b77bb6845194277e8dea006576b636 /mojo/edk | |
parent | d44cce5915db087d726ed2e141896401edeb09b7 (diff) | |
download | chromium_src-07b589c1f6c4d0aac24e270a13fa83031bf2038c.zip chromium_src-07b589c1f6c4d0aac24e270a13fa83031bf2038c.tar.gz chromium_src-07b589c1f6c4d0aac24e270a13fa83031bf2038c.tar.bz2 |
MultiProcessTest: Update SpawnChild* to return a Process.
We should not be dealing with raw handles.
BUG=417532
Review URL: https://codereview.chromium.org/843113003
Cr-Commit-Position: refs/heads/master@{#311127}
Diffstat (limited to 'mojo/edk')
-rw-r--r-- | mojo/edk/test/multiprocess_test_helper.cc | 20 | ||||
-rw-r--r-- | mojo/edk/test/multiprocess_test_helper.h | 4 |
2 files changed, 11 insertions, 13 deletions
diff --git a/mojo/edk/test/multiprocess_test_helper.cc b/mojo/edk/test/multiprocess_test_helper.cc index 758520a..7f44d82 100644 --- a/mojo/edk/test/multiprocess_test_helper.cc +++ b/mojo/edk/test/multiprocess_test_helper.cc @@ -14,14 +14,13 @@ namespace mojo { namespace test { -MultiprocessTestHelper::MultiprocessTestHelper() - : test_child_handle_(base::kNullProcessHandle) { +MultiprocessTestHelper::MultiprocessTestHelper() { platform_channel_pair_.reset(new embedder::PlatformChannelPair()); server_platform_handle = platform_channel_pair_->PassServerHandle(); } MultiprocessTestHelper::~MultiprocessTestHelper() { - CHECK_EQ(test_child_handle_, base::kNullProcessHandle); + CHECK(!test_child_.IsValid()); server_platform_handle.reset(); platform_channel_pair_.reset(); } @@ -29,7 +28,7 @@ MultiprocessTestHelper::~MultiprocessTestHelper() { void MultiprocessTestHelper::StartChild(const std::string& test_child_name) { CHECK(platform_channel_pair_); CHECK(!test_child_name.empty()); - CHECK_EQ(test_child_handle_, base::kNullProcessHandle); + CHECK(!test_child_.IsValid()); std::string test_child_main = test_child_name + "TestChildMain"; @@ -49,21 +48,20 @@ void MultiprocessTestHelper::StartChild(const std::string& test_child_name) { #error "Not supported yet." #endif - test_child_handle_ = + test_child_ = base::SpawnMultiProcessTestChild(test_child_main, command_line, options); platform_channel_pair_->ChildProcessLaunched(); - CHECK_NE(test_child_handle_, base::kNullProcessHandle); + CHECK(test_child_.IsValid()); } int MultiprocessTestHelper::WaitForChildShutdown() { - CHECK_NE(test_child_handle_, base::kNullProcessHandle); + CHECK(test_child_.IsValid()); int rv = -1; - CHECK(base::WaitForExitCodeWithTimeout(test_child_handle_, &rv, - TestTimeouts::action_timeout())); - base::CloseProcessHandle(test_child_handle_); - test_child_handle_ = base::kNullProcessHandle; + CHECK(test_child_.WaitForExitWithTimeout(TestTimeouts::action_timeout(), + &rv)); + test_child_.Close(); return rv; } diff --git a/mojo/edk/test/multiprocess_test_helper.h b/mojo/edk/test/multiprocess_test_helper.h index d131460..e40b309c 100644 --- a/mojo/edk/test/multiprocess_test_helper.h +++ b/mojo/edk/test/multiprocess_test_helper.h @@ -8,7 +8,7 @@ #include <string> #include "base/macros.h" -#include "base/process/process_handle.h" +#include "base/process/process.h" #include "base/test/multiprocess_test.h" #include "base/test/test_timeouts.h" #include "mojo/edk/embedder/scoped_platform_handle.h" @@ -58,7 +58,7 @@ class MultiprocessTestHelper { scoped_ptr<embedder::PlatformChannelPair> platform_channel_pair_; // Valid after |StartChild()| and before |WaitForChildShutdown()|. - base::ProcessHandle test_child_handle_; + base::Process test_child_; DISALLOW_COPY_AND_ASSIGN(MultiprocessTestHelper); }; |