#include "chrome/browser/ui/passwords/well_known_change_password_navigation_throttle.h"
#include <map>
#include <optional>
#include <utility>
#include "base/callback_list.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/time/time.h"
#include "chrome/browser/affiliations/affiliation_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ssl/cert_verifier_browser_test.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h"
#include "chrome/common/url_constants.h"
#include "components/affiliations/core/browser/affiliation_service_impl.h"
#include "components/affiliations/core/browser/hash_affiliation_fetcher.h"
#include "components/affiliations/core/browser/mock_affiliation_service.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/password_manager/core/browser/well_known_change_password/well_known_change_password_util.h"
#include "components/password_manager/core/common/password_manager_features.h"
#include "components/sync/test/test_sync_service.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/mock_navigation_handle.h"
#include "content/public/test/prerender_test_util.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 "net/cert/x509_certificate.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 "services/metrics/public/cpp/ukm_builders.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/page_transition_types.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace {
FacetURI;
MockAffiliationService;
NavigationThrottle;
RenderFrameHost;
TestNavigationObserver;
URLLoaderInterceptor;
BasicHttpResponse;
DelayedHttpResponse;
EmbeddedTestServer;
EmbeddedTestServerHandle;
HttpRequest;
HttpResponse;
kWellKnownChangePasswordPath;
kWellKnownNotExistingResourcePath;
WellKnownChangePasswordResult;
_;
Return;
constexpr char kMockChangePasswordPath[] = …;
struct ServerResponse { … };
struct ResponseDelayParams { … };
}
class WellKnownChangePasswordNavigationThrottleBrowserTest
: public CertVerifierBrowserTest,
public testing::WithParamInterface<
std::tuple<ui::PageTransition, ResponseDelayParams>> { … };
IN_PROC_BROWSER_TEST_P(WellKnownChangePasswordNavigationThrottleBrowserTest,
SupportForChangePassword) { … }
IN_PROC_BROWSER_TEST_P(WellKnownChangePasswordNavigationThrottleBrowserTest,
SupportForChangePassword_WithRedirect) { … }
IN_PROC_BROWSER_TEST_P(
WellKnownChangePasswordNavigationThrottleBrowserTest,
SupportForChangePassword_WithRedirect_FromChromeSettings) { … }
IN_PROC_BROWSER_TEST_P(
WellKnownChangePasswordNavigationThrottleBrowserTest,
SupportForChangePassword_WithRedirect_FromPasswordCheckup) { … }
IN_PROC_BROWSER_TEST_P(WellKnownChangePasswordNavigationThrottleBrowserTest,
SupportForChangePassword_PartialContent) { … }
IN_PROC_BROWSER_TEST_P(
WellKnownChangePasswordNavigationThrottleBrowserTest,
SupportForChangePassword_WithXOriginRedirectToNotFoundPage) { … }
IN_PROC_BROWSER_TEST_P(WellKnownChangePasswordNavigationThrottleBrowserTest,
NoSupportForChangePassword_NotFound) { … }
IN_PROC_BROWSER_TEST_P(WellKnownChangePasswordNavigationThrottleBrowserTest,
NoSupportForChangePassword_WithUrlOverride) { … }
IN_PROC_BROWSER_TEST_P(WellKnownChangePasswordNavigationThrottleBrowserTest,
NoSupportForChangePassword_Ok) { … }
IN_PROC_BROWSER_TEST_P(
WellKnownChangePasswordNavigationThrottleBrowserTest,
NoSupportForChangePassword_WithXOriginRedirectToNotFoundPage) { … }
IN_PROC_BROWSER_TEST_P(WellKnownChangePasswordNavigationThrottleBrowserTest,
NoSupportForChangePassword_WillFailRequest) { … }
IN_PROC_BROWSER_TEST_P(WellKnownChangePasswordNavigationThrottleBrowserTest,
AffiliationServiceReturnsWellKnownChangePasswordPath) { … }
class PrerenderingChangePasswordNavigationThrottleBrowserTest
: public WellKnownChangePasswordNavigationThrottleBrowserTest { … };
IN_PROC_BROWSER_TEST_P(PrerenderingChangePasswordNavigationThrottleBrowserTest,
EnsurePrerenderCanceled) { … }
constexpr ResponseDelayParams kDelayParams[] = …;
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);