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

Unified Diff: chrome/installer/util/delete_tree_work_item_unittest.cc

Issue 9700038: ScopedProcessInformation protects against process/thread handle leaks from CreateProcess calls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove changes from another CL. 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: chrome/installer/util/delete_tree_work_item_unittest.cc
diff --git a/chrome/installer/util/delete_tree_work_item_unittest.cc b/chrome/installer/util/delete_tree_work_item_unittest.cc
index 239e098828134b08fe7631a9464537145139499e..537c6d155bcbbf372085b843c22efacb26b79017 100644
--- a/chrome/installer/util/delete_tree_work_item_unittest.cc
+++ b/chrome/installer/util/delete_tree_work_item_unittest.cc
@@ -14,6 +14,7 @@
#include "base/process_util.h"
#include "base/scoped_temp_dir.h"
#include "base/string_util.h"
+#include "base/win/scoped_process_information.h"
#include "chrome/installer/util/delete_tree_work_item.h"
#include "chrome/installer/util/work_item.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -189,11 +190,11 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeInUse) {
// Run the key path file to keep it in use.
STARTUPINFOW si = {sizeof(si)};
- PROCESS_INFORMATION pi = {0};
+ base::win::ScopedProcessInformation pi;
ASSERT_TRUE(
::CreateProcessW(NULL, const_cast<wchar_t*>(key_path.value().c_str()),
NULL, NULL, FALSE, CREATE_NO_WINDOW | CREATE_SUSPENDED,
- NULL, NULL, &si, &pi));
+ NULL, NULL, &si, pi.Receive()));
// test Do().
{
@@ -214,7 +215,6 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeInUse) {
EXPECT_TRUE(file_util::PathExists(file_name_delete_1));
EXPECT_TRUE(file_util::PathExists(file_name_delete_2));
- TerminateProcess(pi.hProcess, 0);
- // make sure the handle is closed.
- WaitForSingleObject(pi.hProcess, INFINITE);
+ TerminateProcess(pi.Get().hProcess, 0);
+ WaitForSingleObject(pi.Get().hProcess, INFINITE);
}

Powered by Google App Engine
This is Rietveld 408576698