#include "content/browser/loader/prefetch_browsertest_base.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/strings/utf_string_conversions.h"
#include "content/browser/loader/prefetch_url_loader_service_context.h"
#include "content/browser/loader/subresource_proxying_url_loader_service.h"
#include "content/browser/storage_partition_impl.h"
#include "content/browser/web_package/signed_exchange_handler.h"
#include "content/browser/web_package/signed_exchange_loader.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test_utils.h"
#include "content/shell/browser/shell.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
namespace content {
PrefetchBrowserTestBase::ResponseEntry::ResponseEntry() = default;
PrefetchBrowserTestBase::ResponseEntry::ResponseEntry(
const std::string& content,
const std::string& content_type,
const std::vector<std::pair<std::string, std::string>>& headers,
net::HttpStatusCode code)
: … { … }
PrefetchBrowserTestBase::ResponseEntry::ResponseEntry(ResponseEntry&& other) =
default;
PrefetchBrowserTestBase::ResponseEntry::~ResponseEntry() = default;
PrefetchBrowserTestBase::ResponseEntry& PrefetchBrowserTestBase::ResponseEntry::
operator=(ResponseEntry&& other) = default;
PrefetchBrowserTestBase::ScopedSignedExchangeHandlerFactory::
ScopedSignedExchangeHandlerFactory(SignedExchangeHandlerFactory* factory) { … }
PrefetchBrowserTestBase::ScopedSignedExchangeHandlerFactory::
~ScopedSignedExchangeHandlerFactory() { … }
PrefetchBrowserTestBase::PrefetchBrowserTestBase() = default;
PrefetchBrowserTestBase::~PrefetchBrowserTestBase() = default;
void PrefetchBrowserTestBase::SetUpOnMainThread() { … }
void PrefetchBrowserTestBase::RegisterResponse(const std::string& url,
ResponseEntry&& entry) { … }
std::unique_ptr<net::test_server::HttpResponse>
PrefetchBrowserTestBase::ServeResponses(
const net::test_server::HttpRequest& request) { … }
void PrefetchBrowserTestBase::OnPrefetchURLLoaderCalled() { … }
int PrefetchBrowserTestBase::GetPrefetchURLLoaderCallCount() { … }
void PrefetchBrowserTestBase::RegisterRequestHandler(
net::EmbeddedTestServer* test_server) { … }
void PrefetchBrowserTestBase::NavigateToURLAndWaitTitle(
const GURL& url,
const std::string& title) { … }
void PrefetchBrowserTestBase::WaitUntilLoaded(const GURL& url) { … }
void PrefetchBrowserTestBase::RegisterPrefetchLoaderCallback(
base::OnceClosure callback) { … }
scoped_refptr<PrefetchBrowserTestBase::RequestCounter>
PrefetchBrowserTestBase::RequestCounter::CreateAndMonitor(
net::EmbeddedTestServer* test_server,
const std::string& path,
base::RunLoop* waiter) { … }
PrefetchBrowserTestBase::RequestCounter::RequestCounter(const std::string& path,
base::RunLoop* waiter)
: … { … }
PrefetchBrowserTestBase::RequestCounter::~RequestCounter() = default;
int PrefetchBrowserTestBase::RequestCounter::GetRequestCount() { … }
void PrefetchBrowserTestBase::RequestCounter::OnRequest(
const net::test_server::HttpRequest& request) { … }
}