chromium/net/filter/gzip_source_stream_unittest.cc

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include <string>
#include <utility>

#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "net/base/io_buffer.h"
#include "net/base/test_completion_callback.h"
#include "net/filter/filter_source_stream_test_util.h"
#include "net/filter/gzip_source_stream.h"
#include "net/filter/mock_source_stream.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/zlib/zlib.h"

namespace net {

namespace {

const int kBigBufferSize =;
const int kSmallBufferSize =;

enum class ReadResultType {};

// How many bytes to leave unused at the end of |source_data_|. This margin is
// present so that tests that need to append data after the zlib EOF do not run
// out of room in the output buffer.
const size_t kEOFMargin =;

struct GzipTestParam {};

}  // namespace

class GzipSourceStreamTest : public ::testing::TestWithParam<GzipTestParam> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(GzipSourceStreamTest, EmptyStream) {}

TEST_P(GzipSourceStreamTest, DeflateOneBlock) {}

TEST_P(GzipSourceStreamTest, GzipOneBloc) {}

TEST_P(GzipSourceStreamTest, DeflateTwoReads) {}

// Check that any extra bytes after the end of the gzipped data are silently
// ignored.
TEST_P(GzipSourceStreamTest, IgnoreDataAfterEof) {}

TEST_P(GzipSourceStreamTest, MissingZlibHeader) {}

TEST_P(GzipSourceStreamTest, CorruptGzipHeader) {}

// This test checks that the gzip stream source works correctly on 'golden' data
// as produced by gzip(1).
TEST_P(GzipSourceStreamTest, GzipCorrectness) {}

// Same as GzipCorrectness except that last 8 bytes are removed to test that the
// implementation can handle missing footer.
TEST_P(GzipSourceStreamTest, GzipCorrectnessWithoutFooter) {}

// Test with the same compressed data as the above tests, but uses deflate with
// header and checksum. Tests the Z_STREAM_END case in
// STATE_SNIFFING_DEFLATE_HEADER.
TEST_P(GzipSourceStreamTest, DeflateWithAdler32) {}

TEST_P(GzipSourceStreamTest, DeflateWithBadAdler32) {}

TEST_P(GzipSourceStreamTest, DeflateWithoutHeaderWithAdler32) {}

TEST_P(GzipSourceStreamTest, DeflateWithoutHeaderWithBadAdler32) {}

}  // namespace net