#include "components/webapps/browser/web_contents/web_app_url_loader.h"
#include <optional>
#include "base/barrier_closure.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/strings/escape.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/test_mock_time_task_runner.h"
#include "base/time/time.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/test/base/chrome_test_utils.h"
#include "chrome/test/base/platform_browser_test.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/test/browser_test.h"
#include "net/dns/mock_host_resolver.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 "testing/gtest/include/gtest/gtest.h"
#if !BUILDFLAG(IS_ANDROID)
#include "chrome/test/base/ui_test_utils.h"
#endif
namespace webapps {
UrlResult;
UrlComparison;
const char kGenericPageContent[] = …;
std::unique_ptr<net::test_server::HttpResponse> HandleServerRedirect(
const std::string& dest,
const net::test_server::HttpRequest& request) { … }
std::unique_ptr<net::test_server::HttpResponse>
HandleMatchingRequestOrReturnEmptyPage(
const std::string& relative_url,
const net::EmbeddedTestServer::HandleRequestCallback& handler,
const net::test_server::HttpRequest& request) { … }
class WebAppUrlLoaderTest : public PlatformBrowserTest { … };
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, Loaded) { … }
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, LoadedWithParamChangeIgnored) { … }
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest,
LoadedWithParamAndRefChangeIgnored) { … }
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, LoadedWithPathChangeIgnored) { … }
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, RedirectWithParamChange) { … }
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, RedirectWithPathChange) { … }
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, 302FoundRedirect) { … }
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, Http404ErrorWithContent) { … }
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, Http407ErrorWithoutContent) { … }
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, Http500ErrorWithContent) { … }
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, Http500ErrorWithoutContent) { … }
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, Hung) { … }
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, WebContentsDestroyed) { … }
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, MultipleLoadUrlCalls) { … }
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, NetworkError) { … }
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest,
PrepareForLoad_AfterNavigationComplete) { … }
namespace {
class WebContentsLoadingObserver : public content::WebContentsObserver { … };
}
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest,
PrepareForLoad_BeforeNavigationComplete) { … }
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, PrepareForLoad_RecordResultMetric) { … }
}