| 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 now_parts.second = now_parts.second & ~1; | 137 now_parts.second = now_parts.second & ~1; |
| 138 now_parts.millisecond = 0; | 138 now_parts.millisecond = 0; |
| 139 base::Time now_time = base::Time::FromLocalExploded(now_parts); | 139 base::Time now_time = base::Time::FromLocalExploded(now_parts); |
| 140 | 140 |
| 141 EXPECT_EQ(1, file_util::WriteFile(src_file, "1", 1)); | 141 EXPECT_EQ(1, file_util::WriteFile(src_file, "1", 1)); |
| 142 EXPECT_TRUE(base::TouchFile(src_file, base::Time::Now(), test_mtime)); | 142 EXPECT_TRUE(base::TouchFile(src_file, base::Time::Now(), test_mtime)); |
| 143 | 143 |
| 144 EXPECT_TRUE(zip::Zip(src_dir, zip_file, true)); | 144 EXPECT_TRUE(zip::Zip(src_dir, zip_file, true)); |
| 145 ASSERT_TRUE(zip::Unzip(zip_file, out_dir)); | 145 ASSERT_TRUE(zip::Unzip(zip_file, out_dir)); |
| 146 | 146 |
| 147 base::PlatformFileInfo file_info; | 147 base::File::Info file_info; |
| 148 EXPECT_TRUE(base::GetFileInfo(out_file, &file_info)); | 148 EXPECT_TRUE(base::GetFileInfo(out_file, &file_info)); |
| 149 EXPECT_EQ(file_info.size, 1); | 149 EXPECT_EQ(file_info.size, 1); |
| 150 | 150 |
| 151 if (valid_year == VALID_YEAR) { | 151 if (valid_year == VALID_YEAR) { |
| 152 EXPECT_EQ(file_info.last_modified, test_mtime); | 152 EXPECT_EQ(file_info.last_modified, test_mtime); |
| 153 } else { | 153 } else { |
| 154 // Invalid date means the modification time will default to 'now'. | 154 // Invalid date means the modification time will default to 'now'. |
| 155 EXPECT_GE(file_info.last_modified, now_time); | 155 EXPECT_GE(file_info.last_modified, now_time); |
| 156 } | 156 } |
| 157 } | 157 } |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 EXPECT_TRUE(reader.LocateAndOpenEntry(zip_file_list_[i])); | 296 EXPECT_TRUE(reader.LocateAndOpenEntry(zip_file_list_[i])); |
| 297 // Check the path in the entry just in case. | 297 // Check the path in the entry just in case. |
| 298 const zip::ZipReader::EntryInfo* entry_info = reader.current_entry_info(); | 298 const zip::ZipReader::EntryInfo* entry_info = reader.current_entry_info(); |
| 299 EXPECT_EQ(entry_info->file_path(), zip_file_list_[i]); | 299 EXPECT_EQ(entry_info->file_path(), zip_file_list_[i]); |
| 300 } | 300 } |
| 301 } | 301 } |
| 302 #endif // defined(OS_POSIX) | 302 #endif // defined(OS_POSIX) |
| 303 | 303 |
| 304 } // namespace | 304 } // namespace |
| 305 | 305 |
| OLD | NEW |