diff options
author | erikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-04 20:16:32 +0000 |
---|---|---|
committer | erikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-04 20:16:32 +0000 |
commit | 362b88198c4713730eaa93da708a33ab56a0484e (patch) | |
tree | 6ce96a4a6fe4a367cdd5c337bf390a4bd1edb79a /sandbox/src/job_unittest.cc | |
parent | 519fbd840c13c53aaa01fd30cbbeebb134d09a42 (diff) | |
download | chromium_src-362b88198c4713730eaa93da708a33ab56a0484e.zip chromium_src-362b88198c4713730eaa93da708a33ab56a0484e.tar.gz chromium_src-362b88198c4713730eaa93da708a33ab56a0484e.tar.bz2 |
Use ScopedProcessInformation and other RAII types in sandbox.
See http://codereview.chromium.org/9700038/ for the definition of ScopedProcessInformation.
BUG=None
TEST=None
Review URL: https://chromiumcodereview.appspot.com/9959018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130716 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/src/job_unittest.cc')
-rw-r--r-- | sandbox/src/job_unittest.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sandbox/src/job_unittest.cc b/sandbox/src/job_unittest.cc index 0f7010d..f386f1f 100644 --- a/sandbox/src/job_unittest.cc +++ b/sandbox/src/job_unittest.cc @@ -1,9 +1,10 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. // This file contains unit tests for the job object. +#include "base/win/scoped_process_information.h" #include "sandbox/src/job.h" #include "testing/gtest/include/gtest/gtest.h" @@ -159,11 +160,11 @@ TEST(JobTest, ProcessInJob) { wchar_t notepad[] = L"notepad"; STARTUPINFO si = { sizeof(si) }; - PROCESS_INFORMATION pi = {0}; + base::win::ScopedProcessInformation pi; result = ::CreateProcess(NULL, notepad, NULL, NULL, FALSE, 0, NULL, NULL, &si, - &pi); + pi.Receive()); ASSERT_TRUE(result); - ASSERT_EQ(ERROR_SUCCESS, job.AssignProcessToJob(pi.hProcess)); + ASSERT_EQ(ERROR_SUCCESS, job.AssignProcessToJob(pi.process_handle())); // Get the job handle. HANDLE job_handle = job.Detach(); @@ -178,9 +179,9 @@ TEST(JobTest, ProcessInJob) { EXPECT_EQ(1, jbpidl.NumberOfAssignedProcesses); EXPECT_EQ(1, jbpidl.NumberOfProcessIdsInList); - EXPECT_EQ(pi.dwProcessId, jbpidl.ProcessIdList[0]); + EXPECT_EQ(pi.process_id(), jbpidl.ProcessIdList[0]); - EXPECT_TRUE(::TerminateProcess(pi.hProcess, 0)); + EXPECT_TRUE(::TerminateProcess(pi.process_handle(), 0)); EXPECT_TRUE(::CloseHandle(job_handle)); } |