Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: third_party/zlib/google/zip_unittest.cc

Issue 2091673002: Make callers of FromUTC(Local)Exploded in third_party/ use new time API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/zlib/google/zip_reader.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 base::Time test_mtime; 135 base::Time test_mtime;
136 ASSERT_TRUE(base::Time::FromString(date_time, &test_mtime)); 136 ASSERT_TRUE(base::Time::FromString(date_time, &test_mtime));
137 137
138 // Adjusting the current timestamp to the resolution that the zip file 138 // Adjusting the current timestamp to the resolution that the zip file
139 // supports, which is 2 seconds. Note that between this call to Time::Now() 139 // supports, which is 2 seconds. Note that between this call to Time::Now()
140 // and zip::Zip() the clock can advance a bit, hence the use of EXPECT_GE. 140 // and zip::Zip() the clock can advance a bit, hence the use of EXPECT_GE.
141 base::Time::Exploded now_parts; 141 base::Time::Exploded now_parts;
142 base::Time::Now().LocalExplode(&now_parts); 142 base::Time::Now().LocalExplode(&now_parts);
143 now_parts.second = now_parts.second & ~1; 143 now_parts.second = now_parts.second & ~1;
144 now_parts.millisecond = 0; 144 now_parts.millisecond = 0;
145 base::Time now_time = base::Time::FromLocalExploded(now_parts); 145 base::Time now_time;
146 EXPECT_TRUE(base::Time::FromLocalExploded(now_parts, &now_time));
146 147
147 EXPECT_EQ(1, base::WriteFile(src_file, "1", 1)); 148 EXPECT_EQ(1, base::WriteFile(src_file, "1", 1));
148 EXPECT_TRUE(base::TouchFile(src_file, base::Time::Now(), test_mtime)); 149 EXPECT_TRUE(base::TouchFile(src_file, base::Time::Now(), test_mtime));
149 150
150 EXPECT_TRUE(zip::Zip(src_dir, zip_file, true)); 151 EXPECT_TRUE(zip::Zip(src_dir, zip_file, true));
151 ASSERT_TRUE(zip::Unzip(zip_file, out_dir)); 152 ASSERT_TRUE(zip::Unzip(zip_file, out_dir));
152 153
153 base::File::Info file_info; 154 base::File::Info file_info;
154 EXPECT_TRUE(base::GetFileInfo(out_file, &file_info)); 155 EXPECT_TRUE(base::GetFileInfo(out_file, &file_info));
155 EXPECT_EQ(file_info.size, 1); 156 EXPECT_EQ(file_info.size, 1);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 SCOPED_TRACE(base::StringPrintf("Processing %d.txt", i)); 330 SCOPED_TRACE(base::StringPrintf("Processing %d.txt", i));
330 base::FilePath file_path = temp_dir.AppendASCII( 331 base::FilePath file_path = temp_dir.AppendASCII(
331 base::StringPrintf("%d.txt", i)); 332 base::StringPrintf("%d.txt", i));
332 int64_t file_size = -1; 333 int64_t file_size = -1;
333 EXPECT_TRUE(base::GetFileSize(file_path, &file_size)); 334 EXPECT_TRUE(base::GetFileSize(file_path, &file_size));
334 EXPECT_EQ(static_cast<int64_t>(i), file_size); 335 EXPECT_EQ(static_cast<int64_t>(i), file_size);
335 } 336 }
336 } 337 }
337 338
338 } // namespace 339 } // namespace
OLDNEW
« no previous file with comments | « third_party/zlib/google/zip_reader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698