#include <memory>
#include <utility>
#include <vector>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
#include "build/build_config.h"
#include "content/browser/download/download_manager_impl.h"
#include "content/browser/web_contents/web_contents_impl.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/network_service_util.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/site_isolation_policy.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_client.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_content_browser_client.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
#include "content/public/test/url_loader_interceptor.h"
#include "content/shell/browser/shell.h"
#include "net/base/filename_util.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
#include "net/dns/mock_host_resolver.h"
#include "net/http/http_status_code.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "net/test/url_request/url_request_failed_job.h"
#include "net/test/url_request/url_request_mock_http_job.h"
#include "services/network/public/cpp/features.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/blink/public/common/chrome_debug_urls.h"
#include "third_party/blink/public/common/loader/url_loader_throttle.h"
#include "url/gurl.h"
ASCIIToUTF16;
HasSubstr;
Not;
namespace content {
class LoaderBrowserTest : public ContentBrowserTest,
public DownloadManager::Observer { … };
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, DynamicTitle1) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, DynamicTitle2) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest,
DisableReferrersStaleWhileRevalidate) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, SniffNoContentTypeNoData) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, DoNotSniffHTMLFromFileUrl) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, ContentDispositionEmpty) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, ContentDispositionInline) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, SyncXMLHttpRequest) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, SyncXMLHttpRequest_Disallowed) { … }
#if BUILDFLAG(IS_MAC)
#define MAYBE_SyncXMLHttpRequest_DuringUnload …
#else
#define MAYBE_SyncXMLHttpRequest_DuringUnload …
#endif
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest,
MAYBE_SyncXMLHttpRequest_DuringUnload) { … }
namespace {
std::unique_ptr<net::test_server::HttpResponse> CancelOnRequest(
const std::string& relative_url,
int child_id,
base::RepeatingClosure crash_network_service_callback,
const net::test_server::HttpRequest& request) { … }
}
#if BUILDFLAG(IS_ANDROID)
#define MAYBE_SyncXMLHttpRequest_Cancelled …
#else
#define MAYBE_SyncXMLHttpRequest_Cancelled …
#endif
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, MAYBE_SyncXMLHttpRequest_Cancelled) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, DISABLED_CrossSiteOnunloadCookie) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest,
DISABLED_CrossSiteImmediateLoadOnunloadCookie) { … }
namespace {
std::unique_ptr<net::test_server::HttpResponse> NoContentResponseHandler(
const std::string& path,
const net::test_server::HttpRequest& request) { … }
}
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, CrossSiteNoUnloadOn204) { … }
#if BUILDFLAG(IS_MAC)
#define MAYBE_CrossSiteAfterCrash …
#else
#define MAYBE_CrossSiteAfterCrash …
#endif
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, MAYBE_CrossSiteAfterCrash) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, CrossSiteNavigationNonBuffered) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest,
DISABLED_CrossSiteNavigationErrorPage) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, CrossSiteNavigationErrorPage2) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, CrossOriginRedirectBlocked) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, CrossSiteFailedRequest) { … }
namespace {
std::unique_ptr<net::test_server::HttpResponse> HandleRedirectRequest(
const std::string& request_path,
const net::test_server::HttpRequest& request) { … }
}
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, CookiePolicy) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, PageTransitionClientRedirect) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, SubresourceRedirectToDataURLBlocked) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, RedirectToDataURLBlocked) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, RedirectToAboutURLBlocked) { … }
namespace {
GURL CreateFileSystemURL(Shell* window) { … }
}
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest,
SubresourceRedirectToFileSystemURLBlocked) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, RedirectToFileSystemURLBlocked) { … }
namespace {
struct RequestData { … };
}
class RequestDataBrowserTest : public ContentBrowserTest { … };
IN_PROC_BROWSER_TEST_F(RequestDataBrowserTest, Basic) { … }
IN_PROC_BROWSER_TEST_F(RequestDataBrowserTest, LinkRelPrefetch) { … }
IN_PROC_BROWSER_TEST_F(RequestDataBrowserTest, LinkRelPrefetchReferrerPolicy) { … }
IN_PROC_BROWSER_TEST_F(RequestDataBrowserTest, DISABLED_BasicCrossSite) { … }
IN_PROC_BROWSER_TEST_F(RequestDataBrowserTest, SameOriginNested) { … }
IN_PROC_BROWSER_TEST_F(RequestDataBrowserTest, SameOriginAuxiliary) { … }
IN_PROC_BROWSER_TEST_F(RequestDataBrowserTest, CrossOriginAuxiliary) { … }
IN_PROC_BROWSER_TEST_F(RequestDataBrowserTest, FailedNavigation) { … }
IN_PROC_BROWSER_TEST_F(RequestDataBrowserTest, CrossOriginNested) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest,
CookieSameSiteStrictOpenNewNamedWindowTwice) { … }
class URLModifyingThrottle : public blink::URLLoaderThrottle { … };
class ThrottleContentBrowserClient
: public ContentBrowserTestContentBrowserClient { … };
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, URLLoaderThrottleStartModify) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, URLLoaderThrottleRedirectModify) { … }
class LoaderNoScriptStreamingBrowserTest : public ContentBrowserTest { … };
IN_PROC_BROWSER_TEST_F(LoaderNoScriptStreamingBrowserTest, LoadScript) { … }
IN_PROC_BROWSER_TEST_F(LoaderBrowserTest, Subresource304Response) { … }
}