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

Unified Diff: sandbox/src/interception_unittest.cc

Issue 9959018: Use ScopedProcessInformation and other RAII types in sandbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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
Index: sandbox/src/interception_unittest.cc
diff --git a/sandbox/src/interception_unittest.cc b/sandbox/src/interception_unittest.cc
index a0dd98d23cc9d7d255da229a976f14d025d2ee63..bcb576f7ed6682cc1f018f6cf67ccd93726a47e6 100644
--- a/sandbox/src/interception_unittest.cc
+++ b/sandbox/src/interception_unittest.cc
@@ -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(),
erikwright (departed) 2012/03/30 16:29:31 Previously this would have resulted in a call to C
::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;
erikwright (departed) 2012/03/30 16:29:31 ditto
+ 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);

Powered by Google App Engine
This is Rietveld 408576698