| Index: chrome/installer/util/move_tree_work_item_unittest.cc
|
| diff --git a/chrome/installer/util/move_tree_work_item_unittest.cc b/chrome/installer/util/move_tree_work_item_unittest.cc
|
| index e310511a113808810351456c46c0642bc3026a5f..56dff2cc9a76b33878305bc4e8010806a706abf4 100644
|
| --- a/chrome/installer/util/move_tree_work_item_unittest.cc
|
| +++ b/chrome/installer/util/move_tree_work_item_unittest.cc
|
| @@ -12,6 +12,7 @@
|
| #include "base/path_service.h"
|
| #include "base/process_util.h"
|
| #include "base/string_util.h"
|
| +#include "base/win/scoped_process_information.h"
|
| #include "chrome/installer/util/work_item.h"
|
| #include "chrome/installer/util/move_tree_work_item.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -280,12 +281,12 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestInUse) {
|
|
|
| // Run the executable in destination path
|
| STARTUPINFOW si = {sizeof(si)};
|
| - PROCESS_INFORMATION pi = {0};
|
| + base::win::ScopedProcessInformation pi;
|
| ASSERT_TRUE(::CreateProcess(NULL,
|
| const_cast<wchar_t*>(to_file.value().c_str()),
|
| NULL, NULL, FALSE,
|
| CREATE_NO_WINDOW | CREATE_SUSPENDED,
|
| - NULL, NULL, &si, &pi));
|
| + NULL, NULL, &si, pi.Receive()));
|
|
|
| // test Do()
|
| scoped_ptr<MoveTreeWorkItem> work_item(
|
| @@ -308,10 +309,8 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestInUse) {
|
| EXPECT_TRUE(file_util::PathExists(to_dir));
|
| EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, to_file));
|
|
|
| - TerminateProcess(pi.hProcess, 0);
|
| - EXPECT_TRUE(WaitForSingleObject(pi.hProcess, 10000) == WAIT_OBJECT_0);
|
| - CloseHandle(pi.hProcess);
|
| - CloseHandle(pi.hThread);
|
| + TerminateProcess(pi.Get().hProcess, 0);
|
| + EXPECT_TRUE(WaitForSingleObject(pi.Get().hProcess, 10000) == WAIT_OBJECT_0);
|
| }
|
|
|
| // Move one file that is in use to destination.
|
| @@ -343,12 +342,12 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) {
|
|
|
| // Run the executable in source path
|
| STARTUPINFOW si = {sizeof(si)};
|
| - PROCESS_INFORMATION pi = {0};
|
| + base::win::ScopedProcessInformation pi;
|
| ASSERT_TRUE(::CreateProcess(NULL,
|
| const_cast<wchar_t*>(from_file.value().c_str()),
|
| NULL, NULL, FALSE,
|
| CREATE_NO_WINDOW | CREATE_SUSPENDED,
|
| - NULL, NULL, &si, &pi));
|
| + NULL, NULL, &si, pi.Receive()));
|
|
|
| // test Do()
|
| scoped_ptr<MoveTreeWorkItem> work_item(
|
| @@ -365,10 +364,8 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) {
|
|
|
| // Close the process and make sure all the conditions after Do() are
|
| // still true.
|
| - TerminateProcess(pi.hProcess, 0);
|
| - EXPECT_TRUE(WaitForSingleObject(pi.hProcess, 10000) == WAIT_OBJECT_0);
|
| - CloseHandle(pi.hProcess);
|
| - CloseHandle(pi.hThread);
|
| + TerminateProcess(pi.Get().hProcess, 0);
|
| + EXPECT_TRUE(WaitForSingleObject(pi.Get().hProcess, 10000) == WAIT_OBJECT_0);
|
|
|
| EXPECT_TRUE(file_util::PathExists(from_dir));
|
| EXPECT_FALSE(file_util::PathExists(from_file));
|
|
|