From 362b88198c4713730eaa93da708a33ab56a0484e Mon Sep 17 00:00:00 2001 From: "erikwright@chromium.org" Date: Wed, 4 Apr 2012 20:16:32 +0000 Subject: 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 --- sandbox/src/interception_unittest.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'sandbox/src/interception_unittest.cc') 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); -- cgit v1.1