#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_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) { … }
}
}