chromium/net/http/http_response_body_drainer_unittest.cc

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

#include "net/http/http_response_body_drainer.h"

#include <stdint.h>

#include <cstring>
#include <set>
#include <string_view>
#include <utility>

#include "base/compiler_specific.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/no_destructor.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "net/base/completion_once_callback.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/cert/mock_cert_verifier.h"
#include "net/http/http_network_session.h"
#include "net/http/http_server_properties.h"
#include "net/http/http_stream.h"
#include "net/http/transport_security_state.h"
#include "net/proxy_resolution/configured_proxy_resolution_service.h"
#include "net/quic/quic_context.h"
#include "net/socket/socket_test_util.h"
#include "net/ssl/ssl_config_service_defaults.h"
#include "net/test/test_with_task_environment.h"
#include "net/url_request/static_http_user_agent_settings.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace net {

namespace {

const int kMagicChunkSize =;
static_assert;

class CloseResultWaiter {};

class MockHttpStream : public HttpStream {};

int MockHttpStream::ReadResponseBody(IOBuffer* buf,
                                     int buf_len,
                                     CompletionOnceCallback callback) {}

int MockHttpStream::ReadResponseBodyImpl(IOBuffer* buf, int buf_len) {}

void MockHttpStream::CompleteRead() {}

class HttpResponseBodyDrainerTest : public TestWithTaskEnvironment {};

TEST_F(HttpResponseBodyDrainerTest, DrainBodySyncSingleOK) {}

TEST_F(HttpResponseBodyDrainerTest, DrainBodySyncOK) {}

TEST_F(HttpResponseBodyDrainerTest, DrainBodyAsyncOK) {}

// Test the case when the final chunk is 0 bytes. This can happen when
// the final 0-byte chunk of a chunk-encoded http response is read in a last
// call to ReadResponseBody, after all data were returned from HttpStream.
TEST_F(HttpResponseBodyDrainerTest, DrainBodyAsyncEmptyChunk) {}

TEST_F(HttpResponseBodyDrainerTest, DrainBodySyncEmptyChunk) {}

TEST_F(HttpResponseBodyDrainerTest, DrainBodySizeEqualsDrainBuffer) {}

TEST_F(HttpResponseBodyDrainerTest, DrainBodyTimeOut) {}

TEST_F(HttpResponseBodyDrainerTest, CancelledBySession) {}

TEST_F(HttpResponseBodyDrainerTest, DrainBodyTooLarge) {}

TEST_F(HttpResponseBodyDrainerTest, DrainBodyCantReuse) {}

}  // namespace

}  // namespace net