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 "third_party/zlib/google/zip_reader.h" | 5 #include "third_party/zlib/google/zip_reader.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 | 173 |
174 base::MessageLoop message_loop_; | 174 base::MessageLoop message_loop_; |
175 }; | 175 }; |
176 | 176 |
177 TEST_F(ZipReaderTest, Open_ValidZipFile) { | 177 TEST_F(ZipReaderTest, Open_ValidZipFile) { |
178 ZipReader reader; | 178 ZipReader reader; |
179 ASSERT_TRUE(reader.Open(test_zip_file_)); | 179 ASSERT_TRUE(reader.Open(test_zip_file_)); |
180 } | 180 } |
181 | 181 |
182 TEST_F(ZipReaderTest, Open_ValidZipPlatformFile) { | 182 TEST_F(ZipReaderTest, Open_ValidZipPlatformFile) { |
183 FileWrapper zip_fd_wrapper(test_zip_file_, FileWrapper::READ_ONLY); | |
satorux1
2014/11/12 07:04:43
does this have to be moved? otherwise, keep it-as-
jeremyspiegel
2014/11/12 08:52:51
This doesn't have to be moved to work correctly, b
satorux1
2014/11/14 02:27:51
I see. There are many places in the file where Zip
jeremyspiegel
2014/11/14 23:49:25
Ah I missed those. Sounds good, I'll leave this as
| |
183 ZipReader reader; | 184 ZipReader reader; |
184 FileWrapper zip_fd_wrapper(test_zip_file_, FileWrapper::READ_ONLY); | |
185 ASSERT_TRUE(reader.OpenFromPlatformFile(zip_fd_wrapper.platform_file())); | 185 ASSERT_TRUE(reader.OpenFromPlatformFile(zip_fd_wrapper.platform_file())); |
186 } | 186 } |
187 | 187 |
188 TEST_F(ZipReaderTest, Open_NonExistentFile) { | 188 TEST_F(ZipReaderTest, Open_NonExistentFile) { |
189 ZipReader reader; | 189 ZipReader reader; |
190 ASSERT_FALSE(reader.Open(test_data_dir_.AppendASCII("nonexistent.zip"))); | 190 ASSERT_FALSE(reader.Open(test_data_dir_.AppendASCII("nonexistent.zip"))); |
191 } | 191 } |
192 | 192 |
193 TEST_F(ZipReaderTest, Open_ExistentButNonZipFile) { | 193 TEST_F(ZipReaderTest, Open_ExistentButNonZipFile) { |
194 ZipReader reader; | 194 ZipReader reader; |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
567 | 567 |
568 // More than necessary byte read limit: must pass. | 568 // More than necessary byte read limit: must pass. |
569 EXPECT_TRUE(reader.ExtractCurrentEntryToString(16, &contents)); | 569 EXPECT_TRUE(reader.ExtractCurrentEntryToString(16, &contents)); |
570 EXPECT_EQ(i, contents.size()); | 570 EXPECT_EQ(i, contents.size()); |
571 EXPECT_EQ(0, memcmp(contents.c_str(), "0123456", i)); | 571 EXPECT_EQ(0, memcmp(contents.c_str(), "0123456", i)); |
572 } | 572 } |
573 reader.Close(); | 573 reader.Close(); |
574 } | 574 } |
575 | 575 |
576 } // namespace zip | 576 } // namespace zip |
OLD | NEW |