#include "net/test/quic_simple_test_server.h"
#include <memory>
#include <utility>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/message_loop/message_pump_type.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "net/base/port_util.h"
#include "net/quic/crypto/proof_source_chromium.h"
#include "net/test/test_data_directory.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_dispatcher.h"
#include "net/third_party/quiche/src/quiche/quic/tools/quic_memory_cache_backend.h"
#include "net/tools/quic/quic_simple_server.h"
namespace {
const char kTestServerDomain[] = …;
const char kTestServerHost[] = …;
const char kStatusHeader[] = …;
const char kHelloPath[] = …;
const char kHelloBodyValue[] = …;
const char kHelloStatus[] = …;
const char kHelloHeaderName[] = …;
const char kHelloHeaderValue[] = …;
const char kHelloTrailerName[] = …;
const char kHelloTrailerValue[] = …;
const char kSimplePath[] = …;
const char kSimpleBodyValue[] = …;
const char kSimpleStatus[] = …;
const char kSimpleHeaderName[] = …;
const char kSimpleHeaderValue[] = …;
const std::string kCombinedHelloHeaderValue = …;
const char kCombinedHeaderName[] = …;
base::Thread* g_quic_server_thread = …;
quic::QuicMemoryCacheBackend* g_quic_cache_backend = …;
net::QuicSimpleServer* g_quic_server = …;
int g_quic_server_port = …;
}
namespace net {
std::string const QuicSimpleTestServer::GetDomain() { … }
std::string const QuicSimpleTestServer::GetHost() { … }
HostPortPair const QuicSimpleTestServer::GetHostPort() { … }
GURL QuicSimpleTestServer::GetFileURL(const std::string& file_path) { … }
GURL QuicSimpleTestServer::GetHelloURL() { … }
std::string const QuicSimpleTestServer::GetStatusHeaderName() { … }
std::string const QuicSimpleTestServer::GetHelloPath() { … }
std::string const QuicSimpleTestServer::GetHelloBodyValue() { … }
std::string const QuicSimpleTestServer::GetHelloStatus() { … }
std::string const QuicSimpleTestServer::GetHelloHeaderName() { … }
std::string const QuicSimpleTestServer::GetHelloHeaderValue() { … }
std::string const QuicSimpleTestServer::GetCombinedHeaderName() { … }
std::string const QuicSimpleTestServer::GetHelloTrailerName() { … }
std::string const QuicSimpleTestServer::GetHelloTrailerValue() { … }
GURL QuicSimpleTestServer::GetSimpleURL() { … }
std::string const QuicSimpleTestServer::GetSimpleBodyValue() { … }
std::string const QuicSimpleTestServer::GetSimpleStatus() { … }
std::string const QuicSimpleTestServer::GetSimpleHeaderName() { … }
std::string const QuicSimpleTestServer::GetSimpleHeaderValue() { … }
void SetupQuicMemoryCacheBackend() { … }
void StartQuicServerOnServerThread(const base::FilePath& test_files_root,
base::WaitableEvent* server_started_event) { … }
void ShutdownOnServerThread(base::WaitableEvent* server_stopped_event) { … }
void ShutdownDispatcherOnServerThread(
base::WaitableEvent* dispatcher_stopped_event) { … }
bool QuicSimpleTestServer::Start() { … }
void QuicSimpleTestServer::AddResponse(const std::string& path,
quiche::HttpHeaderBlock response_headers,
const std::string& response_body) { … }
void QuicSimpleTestServer::AddResponseWithEarlyHints(
const std::string& path,
const quiche::HttpHeaderBlock& response_headers,
const std::string& response_body,
const std::vector<quiche::HttpHeaderBlock>& early_hints) { … }
void QuicSimpleTestServer::SetResponseDelay(const std::string& path,
base::TimeDelta delay) { … }
void QuicSimpleTestServer::ShutdownDispatcherForTesting() { … }
void QuicSimpleTestServer::Shutdown() { … }
int QuicSimpleTestServer::GetPort() { … }
}