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/interception_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/interception_unittest.cc')
-rw-r--r-- | sandbox/src/interception_unittest.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sandbox/src/interception_unittest.cc b/sandbox/src/interception_unittest.cc index a0dd98d..0dabb84 100644 --- a/sandbox/src/interception_unittest.cc +++ b/sandbox/src/interception_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 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. @@ -79,7 +79,13 @@ TEST(InterceptionManagerTest, BufferLayout1) { wchar_t exe_name[MAX_PATH]; ASSERT_NE(0u, GetModuleFileName(NULL, exe_name, MAX_PATH - 1)); - TargetProcess *target = MakeTestTargetProcess(::GetCurrentProcess(), + base::win::ScopedHandle current_process; + ASSERT_TRUE( + ::DuplicateHandle(::GetCurrentProcess(), ::GetCurrentProcess(), + ::GetCurrentProcess(), current_process.Receive(), + 0, FALSE, DUPLICATE_SAME_ACCESS)); + + TargetProcess *target = MakeTestTargetProcess(current_process.Take(), ::GetModuleHandle(exe_name)); InterceptionManager interceptions(target, true); @@ -166,7 +172,13 @@ TEST(InterceptionManagerTest, BufferLayout2) { wchar_t exe_name[MAX_PATH]; ASSERT_NE(0u, GetModuleFileName(NULL, exe_name, MAX_PATH - 1)); - TargetProcess *target = MakeTestTargetProcess(::GetCurrentProcess(), + base::win::ScopedHandle current_process; + ASSERT_TRUE( + ::DuplicateHandle(::GetCurrentProcess(), ::GetCurrentProcess(), + ::GetCurrentProcess(), current_process.Receive(), + 0, FALSE, DUPLICATE_SAME_ACCESS)); + + TargetProcess *target = MakeTestTargetProcess(current_process.Take(), ::GetModuleHandle(exe_name)); InterceptionManager interceptions(target, true); |