| 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.h" | 10 #include "base/files/file.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 // Adjusting the current timestamp to the resolution that the zip file | 133 // Adjusting the current timestamp to the resolution that the zip file |
| 134 // supports, which is 2 seconds. Note that between this call to Time::Now() | 134 // supports, which is 2 seconds. Note that between this call to Time::Now() |
| 135 // and zip::Zip() the clock can advance a bit, hence the use of EXPECT_GE. | 135 // and zip::Zip() the clock can advance a bit, hence the use of EXPECT_GE. |
| 136 base::Time::Exploded now_parts; | 136 base::Time::Exploded now_parts; |
| 137 base::Time::Now().LocalExplode(&now_parts); | 137 base::Time::Now().LocalExplode(&now_parts); |
| 138 now_parts.second = now_parts.second & ~1; | 138 now_parts.second = now_parts.second & ~1; |
| 139 now_parts.millisecond = 0; | 139 now_parts.millisecond = 0; |
| 140 base::Time now_time = base::Time::FromLocalExploded(now_parts); | 140 base::Time now_time = base::Time::FromLocalExploded(now_parts); |
| 141 | 141 |
| 142 EXPECT_EQ(1, file_util::WriteFile(src_file, "1", 1)); | 142 EXPECT_EQ(1, base::WriteFile(src_file, "1", 1)); |
| 143 EXPECT_TRUE(base::TouchFile(src_file, base::Time::Now(), test_mtime)); | 143 EXPECT_TRUE(base::TouchFile(src_file, base::Time::Now(), test_mtime)); |
| 144 | 144 |
| 145 EXPECT_TRUE(zip::Zip(src_dir, zip_file, true)); | 145 EXPECT_TRUE(zip::Zip(src_dir, zip_file, true)); |
| 146 ASSERT_TRUE(zip::Unzip(zip_file, out_dir)); | 146 ASSERT_TRUE(zip::Unzip(zip_file, out_dir)); |
| 147 | 147 |
| 148 base::File::Info file_info; | 148 base::File::Info file_info; |
| 149 EXPECT_TRUE(base::GetFileInfo(out_file, &file_info)); | 149 EXPECT_TRUE(base::GetFileInfo(out_file, &file_info)); |
| 150 EXPECT_EQ(file_info.size, 1); | 150 EXPECT_EQ(file_info.size, 1); |
| 151 | 151 |
| 152 if (valid_year == VALID_YEAR) { | 152 if (valid_year == VALID_YEAR) { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 for (size_t i = 0; i < zip_file_list_.size(); ++i) { | 296 for (size_t i = 0; i < zip_file_list_.size(); ++i) { |
| 297 EXPECT_TRUE(reader.LocateAndOpenEntry(zip_file_list_[i])); | 297 EXPECT_TRUE(reader.LocateAndOpenEntry(zip_file_list_[i])); |
| 298 // Check the path in the entry just in case. | 298 // Check the path in the entry just in case. |
| 299 const zip::ZipReader::EntryInfo* entry_info = reader.current_entry_info(); | 299 const zip::ZipReader::EntryInfo* entry_info = reader.current_entry_info(); |
| 300 EXPECT_EQ(entry_info->file_path(), zip_file_list_[i]); | 300 EXPECT_EQ(entry_info->file_path(), zip_file_list_[i]); |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 #endif // defined(OS_POSIX) | 303 #endif // defined(OS_POSIX) |
| 304 | 304 |
| 305 } // namespace | 305 } // namespace |
| OLD | NEW |