chromium/third_party/perfetto/src/trace_processor/util/zip_reader_unittest.cc

/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "src/trace_processor/util/zip_reader.h"

#include <cstdint>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>

#include "perfetto/base/build_config.h"
#include "perfetto/base/status.h"
#include "perfetto/ext/base/string_view.h"
#include "perfetto/trace_processor/trace_blob.h"
#include "perfetto/trace_processor/trace_blob_view.h"
#include "src/base/test/status_matchers.h"
#include "test/gtest_and_gmock.h"

namespace perfetto::trace_processor::util {
namespace {
IsError;

// This zip file contains the following:
// Zip file size: 386 bytes, number of entries: 2
// -rw-r--r--  3.0 unx        4 tx stor 22-Jul-25 16:43 stored_file
// -rw-r--r--  3.0 unx       89 tx defN 22-Jul-25 18:34 dir/deflated_file
// 2 files, 92 bytes uncompressed, 52 bytes compressed:  43.5%
//
// /stored_file      content: "foo"
// dir/deflated_file content: 2x "The quick brown fox jumps over the lazy dog\n"
const uint8_t kTestZip[] =;

std::string vec2str(const std::vector<uint8_t>& vec) {}

void ValidateTestZip(ZipReader& zr) {}

TEST(ZipReaderTest, ValidZip_OneShotParse) {}

TEST(ZipReaderTest, ValidZip_OneByteChunks) {}

TEST(ZipReaderTest, MalformedZip_InvalidSignature) {}

TEST(ZipReaderTest, MalformedZip_VersionTooHigh) {}

TEST(ZipReaderTest, TruncatedZip) {}

TEST(ZipReaderTest, Find) {}

// All the tests below require zlib.
#if PERFETTO_BUILDFLAG(PERFETTO_ZLIB)

TEST(ZipReaderTest, ValidZip_DecompressLines) {}

TEST(ZipReaderTest, MalformedZip_DecomprError) {}

#endif  // PERFETTO_BUILDFLAG(PERFETTO_ZLIB)

}  // namespace
}  // namespace perfetto::trace_processor::util