| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/threading/platform_thread.h" | 15 #include "base/threading/platform_thread.h" |
| 16 #include "chrome/installer/util/copy_tree_work_item.h" | 16 #include "chrome/installer/util/copy_tree_work_item.h" |
| 17 #include "chrome/installer/util/work_item.h" | 17 #include "chrome/installer/util/work_item.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 class CopyTreeWorkItemTest : public testing::Test { | 22 class CopyTreeWorkItemTest : public testing::Test { |
| 23 protected: | 23 protected: |
| 24 virtual void SetUp() { | 24 void SetUp() override { |
| 25 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 25 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 26 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); | 26 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); |
| 27 } | 27 } |
| 28 | 28 |
| 29 virtual void TearDown() { | 29 void TearDown() override { logging::CloseLogFile(); } |
| 30 logging::CloseLogFile(); | |
| 31 } | |
| 32 | 30 |
| 33 // the path to temporary directory used to contain the test operations | 31 // the path to temporary directory used to contain the test operations |
| 34 base::ScopedTempDir test_dir_; | 32 base::ScopedTempDir test_dir_; |
| 35 base::ScopedTempDir temp_dir_; | 33 base::ScopedTempDir temp_dir_; |
| 36 }; | 34 }; |
| 37 | 35 |
| 38 // Simple function to dump some text into a new file. | 36 // Simple function to dump some text into a new file. |
| 39 void CreateTextFile(const std::wstring& filename, | 37 void CreateTextFile(const std::wstring& filename, |
| 40 const std::wstring& contents) { | 38 const std::wstring& contents) { |
| 41 std::ofstream file; | 39 std::ofstream file; |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 EXPECT_TRUE(base::ContentsEqual(file_name_from_1, file_name_to_1)); | 712 EXPECT_TRUE(base::ContentsEqual(file_name_from_1, file_name_to_1)); |
| 715 | 713 |
| 716 base::FilePath file_name_to_2(dir_name_to); | 714 base::FilePath file_name_to_2(dir_name_to); |
| 717 file_name_to_2 = file_name_to_2.AppendASCII("2"); | 715 file_name_to_2 = file_name_to_2.AppendASCII("2"); |
| 718 file_name_to_2 = file_name_to_2.AppendASCII("File_2.txt"); | 716 file_name_to_2 = file_name_to_2.AppendASCII("File_2.txt"); |
| 719 EXPECT_TRUE(base::PathExists(file_name_to_2)); | 717 EXPECT_TRUE(base::PathExists(file_name_to_2)); |
| 720 VLOG(1) << "compare " << file_name_from_2.value() | 718 VLOG(1) << "compare " << file_name_from_2.value() |
| 721 << " and " << file_name_to_2.value(); | 719 << " and " << file_name_to_2.value(); |
| 722 EXPECT_TRUE(base::ContentsEqual(file_name_from_2, file_name_to_2)); | 720 EXPECT_TRUE(base::ContentsEqual(file_name_from_2, file_name_to_2)); |
| 723 } | 721 } |
| OLD | NEW |