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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 namespace zip { | 115 namespace zip { |
116 | 116 |
117 // Make the test a PlatformTest to setup autorelease pools properly on Mac. | 117 // Make the test a PlatformTest to setup autorelease pools properly on Mac. |
118 class ZipReaderTest : public PlatformTest { | 118 class ZipReaderTest : public PlatformTest { |
119 protected: | 119 protected: |
120 virtual void SetUp() { | 120 virtual void SetUp() { |
121 PlatformTest::SetUp(); | 121 PlatformTest::SetUp(); |
122 | 122 |
123 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 123 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
124 test_dir_ = temp_dir_.path(); | 124 test_dir_ = temp_dir_.GetPath(); |
125 | 125 |
126 ASSERT_TRUE(GetTestDataDirectory(&test_data_dir_)); | 126 ASSERT_TRUE(GetTestDataDirectory(&test_data_dir_)); |
127 | 127 |
128 test_zip_file_ = test_data_dir_.AppendASCII("test.zip"); | 128 test_zip_file_ = test_data_dir_.AppendASCII("test.zip"); |
129 evil_zip_file_ = test_data_dir_.AppendASCII("evil.zip"); | 129 evil_zip_file_ = test_data_dir_.AppendASCII("evil.zip"); |
130 evil_via_invalid_utf8_zip_file_ = test_data_dir_.AppendASCII( | 130 evil_via_invalid_utf8_zip_file_ = test_data_dir_.AppendASCII( |
131 "evil_via_invalid_utf8.zip"); | 131 "evil_via_invalid_utf8.zip"); |
132 evil_via_absolute_file_name_zip_file_ = test_data_dir_.AppendASCII( | 132 evil_via_absolute_file_name_zip_file_ = test_data_dir_.AppendASCII( |
133 "evil_via_absolute_file_name.zip"); | 133 "evil_via_absolute_file_name.zip"); |
134 | 134 |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 ASSERT_TRUE(writer.PrepareOutput()); | 683 ASSERT_TRUE(writer.PrepareOutput()); |
684 ASSERT_TRUE(writer.WriteBytes(kSomeData, kSomeDataLen)); | 684 ASSERT_TRUE(writer.WriteBytes(kSomeData, kSomeDataLen)); |
685 } | 685 } |
686 ASSERT_EQ(kSomeDataLen, file_.GetLength()); | 686 ASSERT_EQ(kSomeDataLen, file_.GetLength()); |
687 char buf[kSomeDataLen] = {}; | 687 char buf[kSomeDataLen] = {}; |
688 ASSERT_EQ(kSomeDataLen, file_.Read(0LL, buf, kSomeDataLen)); | 688 ASSERT_EQ(kSomeDataLen, file_.Read(0LL, buf, kSomeDataLen)); |
689 ASSERT_EQ(std::string(kSomeData), std::string(buf, kSomeDataLen)); | 689 ASSERT_EQ(std::string(kSomeData), std::string(buf, kSomeDataLen)); |
690 } | 690 } |
691 | 691 |
692 } // namespace zip | 692 } // namespace zip |
OLD | NEW |