#include "content/browser/renderer_host/navigation_throttle_runner.h"
#include <optional>
#include "base/functional/bind.h"
#include "base/metrics/metrics_hashes.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/public/browser/navigation_throttle.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/mock_navigation_handle.h"
#include "content/public/test/test_navigation_throttle.h"
#include "content/public/test/test_renderer_host.h"
#include "services/metrics/public/cpp/ukm_builders.h"
namespace content {
class DeletingNavigationThrottle : public NavigationThrottle { … };
class NavigationThrottleRunnerTest : public RenderViewHostTestHarness,
public NavigationThrottleRunner::Delegate { … };
class NavigationThrottleRunnerTestWithEvent
: public NavigationThrottleRunnerTest,
public testing::WithParamInterface<NavigationThrottleRunner::Event> { … };
TEST_P(NavigationThrottleRunnerTestWithEvent, ResumeDeferred) { … }
TEST_P(NavigationThrottleRunnerTestWithEvent, DeletionByNavigationThrottle) { … }
TEST_P(NavigationThrottleRunnerTestWithEvent,
DeletionByNavigationThrottleAfterResume) { … }
INSTANTIATE_TEST_SUITE_P(…);
class NavigationThrottleRunnerTestWithEventAndAction
: public NavigationThrottleRunnerTest,
public testing::WithParamInterface<
std::tuple<NavigationThrottleRunner::Event,
NavigationThrottle::ThrottleAction>> { … };
TEST_P(NavigationThrottleRunnerTestWithEventAndAction, DeferThenAction) { … }
TEST_P(NavigationThrottleRunnerTestWithEventAndAction, CancelThenProceed) { … }
TEST_P(NavigationThrottleRunnerTestWithEventAndAction, ProceedThenCancel) { … }
TEST_P(NavigationThrottleRunnerTestWithEventAndAction, DeferRecordsUKM) { … }
INSTANTIATE_TEST_SUITE_P(…);
class NavigationThrottleRunnerTestWithEventAndError
: public NavigationThrottleRunnerTest,
public testing::WithParamInterface<
std::tuple<NavigationThrottleRunner::Event,
net::Error,
std::optional<std::string>>> { … };
TEST_P(NavigationThrottleRunnerTestWithEventAndError, CustomNetError) { … }
INSTANTIATE_TEST_SUITE_P(…);
}