#include "third_party/zlib/google/zip.h"
#include <stddef.h>
#include <stdint.h>
#include <iomanip>
#include <limits>
#include <string>
#include <string_view>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "base/files/file.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
#include "third_party/zlib/google/zip_internal.h"
#include "third_party/zlib/google/zip_reader.h"
#define FP(path) …
namespace {
UnorderedElementsAre;
UnorderedElementsAreArray;
std::vector<std::string> GetRelativePaths(const base::FilePath& dir,
base::FileEnumerator::FileType type) { … }
bool CreateFile(const std::string& content,
base::FilePath* file_path,
base::File* file) { … }
class ProgressWriterDelegate : public zip::WriterDelegate { … };
class VirtualFileSystem : public zip::FileAccessor { … };
constexpr char VirtualFileSystem::kFooContent[];
constexpr char VirtualFileSystem::kBar1Content[];
constexpr char VirtualFileSystem::kBar2Content[];
class ZipTest : public PlatformTest { … };
TEST_F(ZipTest, UnzipNoSuchFile) { … }
TEST_F(ZipTest, Unzip) { … }
TEST_F(ZipTest, UnzipUncompressed) { … }
TEST_F(ZipTest, UnzipEvil) { … }
TEST_F(ZipTest, UnzipEvil2) { … }
TEST_F(ZipTest, UnzipWithFilter) { … }
TEST_F(ZipTest, UnzipEncryptedWithRightPassword) { … }
TEST_F(ZipTest, UnzipEncryptedWithWrongPassword) { … }
TEST_F(ZipTest, UnzipEncryptedWithNoPassword) { … }
TEST_F(ZipTest, UnzipEncryptedContinueOnError) { … }
TEST_F(ZipTest, UnzipWrongCrc) { … }
TEST_F(ZipTest, UnzipRepeatedDirName) { … }
TEST_F(ZipTest, UnzipRepeatedFileName) { … }
TEST_F(ZipTest, UnzipCannotCreateEmptyDir) { … }
TEST_F(ZipTest, UnzipCannotCreateParentDir) { … }
TEST_F(ZipTest, UnzipWindowsSpecialNames) { … }
TEST_F(ZipTest, UnzipDifferentCases) { … }
TEST_F(ZipTest, UnzipDifferentCasesContinueOnError) { … }
TEST_F(ZipTest, UnzipMixedPaths) { … }
TEST_F(ZipTest, UnzipWithDelegates) { … }
TEST_F(ZipTest, UnzipOnlyDirectories) { … }
TEST_F(ZipTest, UnzipSjis) { … }
TEST_F(ZipTest, UnzipSjisAsUtf8) { … }
TEST_F(ZipTest, Zip) { … }
TEST_F(ZipTest, ZipIgnoreHidden) { … }
TEST_F(ZipTest, ZipNonASCIIDir) { … }
TEST_F(ZipTest, ZipTimeStamp) { … }
#if defined(OS_POSIX) || defined(OS_FUCHSIA)
TEST_F(ZipTest, ZipFiles) { … }
#endif
TEST_F(ZipTest, UnzipFilesWithIncorrectSize) { … }
TEST_F(ZipTest, ZipWithFileAccessor) { … }
TEST_F(ZipTest, ZipProgress) { … }
TEST_F(ZipTest, ZipProgressPeriod) { … }
TEST_F(ZipTest, ZipCancel) { … }
TEST_F(ZipTest, GetCompressionMethod) { … }
TEST_F(ZipTest, Compressed) { … }
TEST_F(ZipTest, NestedZip) { … }
#if defined(THREAD_SANITIZER) || BUILDFLAG(IS_FUCHSIA) || \
BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
BUILDFLAG(IS_CHROMEOS) || !defined(NDEBUG)
TEST_F(ZipTest, DISABLED_BigFile) { … }
}