| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <windows.h> | 5 #include <windows.h> |
| 6 | 6 |
| 7 #include <fstream> | 7 #include <fstream> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "chrome/installer/util/delete_tree_work_item.h" | 15 #include "chrome/installer/util/delete_tree_work_item.h" |
| 16 #include "chrome/installer/util/work_item.h" | 16 #include "chrome/installer/util/work_item.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 class DeleteTreeWorkItemTest : public testing::Test { | 21 class DeleteTreeWorkItemTest : public testing::Test { |
| 22 protected: | 22 protected: |
| 23 virtual void SetUp() { | 23 void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } |
| 24 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | |
| 25 } | |
| 26 | 24 |
| 27 // The temporary directory used to contain the test operations. | 25 // The temporary directory used to contain the test operations. |
| 28 base::ScopedTempDir temp_dir_; | 26 base::ScopedTempDir temp_dir_; |
| 29 }; | 27 }; |
| 30 | 28 |
| 31 // Simple function to dump some text into a new file. | 29 // Simple function to dump some text into a new file. |
| 32 void CreateTextFile(const std::wstring& filename, | 30 void CreateTextFile(const std::wstring& filename, |
| 33 const std::wstring& contents) { | 31 const std::wstring& contents) { |
| 34 std::ofstream file; | 32 std::ofstream file; |
| 35 file.open(filename.c_str()); | 33 file.open(filename.c_str()); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 209 |
| 212 // verify everything is still there. | 210 // verify everything is still there. |
| 213 EXPECT_TRUE(base::PathExists(key_path)); | 211 EXPECT_TRUE(base::PathExists(key_path)); |
| 214 EXPECT_TRUE(base::PathExists(file_name_delete_1)); | 212 EXPECT_TRUE(base::PathExists(file_name_delete_1)); |
| 215 EXPECT_TRUE(base::PathExists(file_name_delete_2)); | 213 EXPECT_TRUE(base::PathExists(file_name_delete_2)); |
| 216 | 214 |
| 217 TerminateProcess(pi.hProcess, 0); | 215 TerminateProcess(pi.hProcess, 0); |
| 218 // make sure the handle is closed. | 216 // make sure the handle is closed. |
| 219 WaitForSingleObject(pi.hProcess, INFINITE); | 217 WaitForSingleObject(pi.hProcess, INFINITE); |
| 220 } | 218 } |
| OLD | NEW |