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

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

Issue 106663006: Followup for bug when zipping a folder with non-ascii chars in its name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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.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 <set> 5 #include <set>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_enumerator.h" 9 #include "base/files/file_enumerator.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 src_dir = src_dir.AppendASCII("test"); 167 src_dir = src_dir.AppendASCII("test");
168 168
169 base::ScopedTempDir temp_dir; 169 base::ScopedTempDir temp_dir;
170 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 170 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
171 base::FilePath zip_file = temp_dir.path().AppendASCII("out.zip"); 171 base::FilePath zip_file = temp_dir.path().AppendASCII("out.zip");
172 172
173 EXPECT_TRUE(zip::Zip(src_dir, zip_file, false)); 173 EXPECT_TRUE(zip::Zip(src_dir, zip_file, false));
174 TestUnzipFile(zip_file, false); 174 TestUnzipFile(zip_file, false);
175 } 175 }
176 176
177 TEST_F(ZipTest, ZipNonASCIIDir) {
178 base::FilePath src_dir;
179 ASSERT_TRUE(GetTestDataDirectory(&src_dir));
180 src_dir = src_dir.AppendASCII("test");
181
182 base::ScopedTempDir temp_dir;
183 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
184 // Append 'Тест' (in cyrillic).
185 base::FilePath src_dir_russian =
186 temp_dir.path().Append(base::FilePath::FromUTF8Unsafe(
187 "\xD0\xA2\xD0\xB5\xD1\x81\xD1\x82"));
188 base::CopyDirectory(src_dir, src_dir_russian, true);
189 base::FilePath zip_file = temp_dir.path().AppendASCII("out_russian.zip");
190
191 EXPECT_TRUE(zip::Zip(src_dir_russian, zip_file, true));
192 TestUnzipFile(zip_file, true);
193 }
194
177 #if defined(OS_POSIX) 195 #if defined(OS_POSIX)
178 TEST_F(ZipTest, ZipFiles) { 196 TEST_F(ZipTest, ZipFiles) {
179 base::FilePath src_dir; 197 base::FilePath src_dir;
180 ASSERT_TRUE(GetTestDataDirectory(&src_dir)); 198 ASSERT_TRUE(GetTestDataDirectory(&src_dir));
181 src_dir = src_dir.AppendASCII("test"); 199 src_dir = src_dir.AppendASCII("test");
182 200
183 base::ScopedTempDir temp_dir; 201 base::ScopedTempDir temp_dir;
184 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 202 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
185 base::FilePath zip_file = temp_dir.path().AppendASCII("out.zip"); 203 base::FilePath zip_file = temp_dir.path().AppendASCII("out.zip");
186 204
(...skipping 11 matching lines...) Expand all
198 EXPECT_TRUE(reader.LocateAndOpenEntry(zip_file_list_[i])); 216 EXPECT_TRUE(reader.LocateAndOpenEntry(zip_file_list_[i]));
199 // Check the path in the entry just in case. 217 // Check the path in the entry just in case.
200 const zip::ZipReader::EntryInfo* entry_info = reader.current_entry_info(); 218 const zip::ZipReader::EntryInfo* entry_info = reader.current_entry_info();
201 EXPECT_EQ(entry_info->file_path(), zip_file_list_[i]); 219 EXPECT_EQ(entry_info->file_path(), zip_file_list_[i]);
202 } 220 }
203 } 221 }
204 #endif // defined(OS_POSIX) 222 #endif // defined(OS_POSIX)
205 223
206 } // namespace 224 } // namespace
207 225
OLDNEW
« no previous file with comments | « third_party/zlib/google/zip.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698