#include "content/browser/interest_group/ad_auction_url_loader_interceptor.h"
#include <string_view>
#include "base/base64url.h"
#include "base/memory/scoped_refptr.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "content/browser/interest_group/ad_auction_page_data.h"
#include "content/browser/interest_group/header_direct_from_seller_signals.h"
#include "content/browser/loader/subresource_proxying_url_loader_service.h"
#include "content/browser/web_package/prefetched_signed_exchange_cache.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/test_utils.h"
#include "content/public/test/web_contents_tester.h"
#include "content/test/test_render_frame_host.h"
#include "content/test/test_render_view_host.h"
#include "mojo/public/cpp/system/functions.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/public/cpp/wrapper_shared_url_loader_factory.h"
#include "services/network/public/mojom/early_hints.mojom.h"
#include "services/network/public/mojom/parsed_headers.mojom.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace content {
namespace {
constexpr char kLegitimateAdAuctionResponse[] = …;
constexpr char kLegitimateAdAuctionSignals[] = …;
FollowRedirectParams;
std::string base64Decode(std::string_view input) { … }
class InterceptingContentBrowserClient : public ContentBrowserClient { … };
class TestURLLoaderClient : public network::mojom::URLLoaderClient { … };
}
class AdAuctionURLLoaderInterceptorTest : public RenderViewHostTestHarness { … };
TEST_F(AdAuctionURLLoaderInterceptorTest, RequestArrivedBeforeCommit) { … }
TEST_F(AdAuctionURLLoaderInterceptorTest, RequestArrivedAfterCommit) { … }
TEST_F(AdAuctionURLLoaderInterceptorTest, RequestOnClonedPipeBeforeCommit) { … }
TEST_F(AdAuctionURLLoaderInterceptorTest, RequestFromMainFrame) { … }
TEST_F(AdAuctionURLLoaderInterceptorTest, RequestFromSubframe) { … }
TEST_F(AdAuctionURLLoaderInterceptorTest,
RequestNotEligibleForAdAuctionHeadersDueToMissingFetchParam) { … }
TEST_F(AdAuctionURLLoaderInterceptorTest,
HasRedirect_AdAuctionResultResponseIgnored) { … }
TEST_F(AdAuctionURLLoaderInterceptorTest, AdAuctionSignalsResponseHeader) { … }
TEST_F(AdAuctionURLLoaderInterceptorTest,
HasRedirect_AdAuctionSignalsResponseIgnored) { … }
TEST_F(AdAuctionURLLoaderInterceptorTest, AdditionalBids) { … }
TEST_F(
AdAuctionURLLoaderInterceptorTest,
AdAuctionDisallowedBySettings_AdditionalBidResponseHeaderNotHandledAndRemoved) { … }
TEST_F(AdAuctionURLLoaderInterceptorTest,
HasRedirect_AdditionalBidResponseHeaderIgnoredAndRemoved) { … }
}