| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/file_util.h" | |
| 8 #include "base/files/file.h" | 7 #include "base/files/file.h" |
| 9 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/win/scoped_handle.h" | 11 #include "base/win/scoped_handle.h" |
| 12 #include "chrome/installer/util/logging_installer.h" | 12 #include "chrome/installer/util/logging_installer.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 TEST(LoggingInstallerTest, TestTruncate) { | 15 TEST(LoggingInstallerTest, TestTruncate) { |
| 16 const std::string test_data(installer::kMaxInstallerLogFileSize + 1, 'a'); | 16 const std::string test_data(installer::kMaxInstallerLogFileSize + 1, 'a'); |
| 17 | 17 |
| 18 base::ScopedTempDir temp_dir; | 18 base::ScopedTempDir temp_dir; |
| 19 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 19 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 base::File::FLAG_EXCLUSIVE_READ; | 108 base::File::FLAG_EXCLUSIVE_READ; |
| 109 base::FilePath temp_file_move_dest( | 109 base::FilePath temp_file_move_dest( |
| 110 temp_file.value() + FILE_PATH_LITERAL(".tmp")); | 110 temp_file.value() + FILE_PATH_LITERAL(".tmp")); |
| 111 base::File temp_move_destination_file(temp_file_move_dest, file_flags); | 111 base::File temp_move_destination_file(temp_file_move_dest, file_flags); |
| 112 ASSERT_TRUE(temp_move_destination_file.IsValid()); | 112 ASSERT_TRUE(temp_move_destination_file.IsValid()); |
| 113 | 113 |
| 114 EXPECT_EQ(installer::LOGFILE_DELETED, | 114 EXPECT_EQ(installer::LOGFILE_DELETED, |
| 115 installer::TruncateLogFileIfNeeded(temp_file)); | 115 installer::TruncateLogFileIfNeeded(temp_file)); |
| 116 EXPECT_FALSE(base::PathExists(temp_file)); | 116 EXPECT_FALSE(base::PathExists(temp_file)); |
| 117 } | 117 } |
| OLD | NEW |