#include "net/url_request/url_request_job.h"
#include <memory>
#include <optional>
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "net/base/features.h"
#include "net/base/request_priority.h"
#include "net/http/http_transaction_test_util.h"
#include "net/test/cert_test_util.h"
#include "net/test/gtest_util.h"
#include "net/test/test_data_directory.h"
#include "net/test/test_with_task_environment.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/referrer_policy.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/url_util.h"
IsError;
IsOk;
namespace net {
namespace {
const char kHelloData[] = …;
const char kBrotliHelloData[] = …;
const char kGzipData[] = …;
const char kGzipDataWithName[] = …;
const char kGzipHelloData[] = …;
void GZipServer(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) { … }
void GZipHelloServer(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) { … }
void BigGZipServer(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) { … }
void BrotliHelloServer(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) { … }
void MakeMockReferrerPolicyTransaction(const char* referer_header,
const char* response_headers,
MockTransaction* transaction) { … }
const MockTransaction kNoFilterTransaction = …;
const MockTransaction kNoFilterTransactionWithInvalidLength = …;
const MockTransaction kGZipTransaction = …;
const MockTransaction kGzipSlowTransaction = …;
const MockTransaction kRedirectTransaction = …;
const MockTransaction kEmptyBodyGzipTransaction = …;
const MockTransaction kInvalidContentGZipTransaction = …;
const MockTransaction kBrotliSlowTransaction = …;
}
URLRequestJobTest;
TEST_F(URLRequestJobTest, TransactionNoFilter) { … }
TEST_F(URLRequestJobTest, TransactionNoFilterWithInvalidLength) { … }
TEST_F(URLRequestJobTest, TransactionNotifiedWhenDone) { … }
TEST_F(URLRequestJobTest, SyncTransactionNotifiedWhenDone) { … }
TEST_F(URLRequestJobTest, SyncSlowTransaction) { … }
TEST_F(URLRequestJobTest, RedirectTransactionNotifiedWhenDone) { … }
TEST_F(URLRequestJobTest, RedirectTransactionWithReferrerPolicyHeader) { … }
TEST_F(URLRequestJobTest, TransactionNotCachedWhenNetworkDelegateRedirects) { … }
TEST_F(URLRequestJobTest, EmptyBodySkipFilter) { … }
TEST_F(URLRequestJobTest, InvalidContentGZipTransaction) { … }
TEST_F(URLRequestJobTest, SlowFilterRead) { … }
TEST_F(URLRequestJobTest, SlowBrotliRead) { … }
TEST(URLRequestJobComputeReferrer, SetsSameOriginForMetricsOnSameOrigin) { … }
TEST(URLRequestJobComputeReferrer, SetsSameOriginForMetricsOnCrossOrigin) { … }
TEST(URLRequestJobComputeReferrer, AcceptsNullptrInput) { … }
TEST(URLRequestJobComputeReferrer, FilesystemDestination) { … }
TEST(URLRequestJobComputeReferrer, TruncatesLongReferrer) { … }
TEST(URLRequestJobComputeReferrer, DoesntTruncateShortReferrer) { … }
TEST(URLRequestJobComputeReferrer, DoesntTruncateEvenShorterReferrer) { … }
TEST(URLRequestJobComputeReferrer, DoesntTruncateReferrerWithLongRef) { … }
TEST(URLRequestJobComputeReferrer, InvalidSchemeReferrer) { … }
TEST(URLRequestJobComputeReferrer, CapReferrerOnCrossOrigin) { … }
TEST(URLRequestJobComputeReferrer,
CapReferrerOnCrossOriginRespectsStricterPolicy) { … }
TEST(URLRequestJobComputeReferrer,
CapReferrerOnCrossOriginDoesntCapOnSameOrigin) { … }
}