#include "content/browser/preloading/prerender/prerender_host.h"
#include <memory>
#include "base/functional/bind.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/bind.h"
#include "base/test/gmock_expected_support.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/browser/preloading/preloading.h"
#include "content/browser/preloading/prerender/prerender_attributes.h"
#include "content/browser/preloading/prerender/prerender_features.h"
#include "content/browser/preloading/prerender/prerender_final_status.h"
#include "content/browser/preloading/prerender/prerender_host.h"
#include "content/browser/preloading/prerender/prerender_host_registry.h"
#include "content/browser/preloading/prerender/prerender_metrics.h"
#include "content/public/browser/preloading.h"
#include "content/public/browser/preloading_data.h"
#include "content/public/test/mock_web_contents_observer.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/preloading_test_util.h"
#include "content/public/test/prerender_test_util.h"
#include "content/test/mock_commit_deferring_condition.h"
#include "content/test/navigation_simulator_impl.h"
#include "content/test/test_render_frame_host.h"
#include "content/test/test_render_view_host.h"
#include "content/test/test_web_contents.h"
#include "net/http/http_request_headers.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "third_party/blink/public/common/loader/loader_constants.h"
#include "third_party/blink/public/mojom/speculation_rules/speculation_rules.mojom-shared.h"
namespace content {
namespace {
_;
TEST(IsActivationHeaderMatchTest, OrderInsensitive) { … }
TEST(IsActivationHeaderMatchTest, KeyCaseInsensitive) { … }
TEST(IsActivationHeaderMatchTest, ValueCaseInsensitive) { … }
TEST(IsActivationHeaderMatchTest, CalculateMismatchedHeaders) { … }
ExpectedReadyForActivationState;
void CommitPrerenderNavigation(
PrerenderHost& host,
ExpectedReadyForActivationState ready_for_activation =
ExpectedReadyForActivationState(true),
scoped_refptr<net::HttpResponseHeaders> headers = nullptr) { … }
std::unique_ptr<NavigationSimulatorImpl> CreateActivation(
const GURL& prerendering_url,
WebContentsImpl& web_contents) { … }
class PrerenderHostTest : public RenderViewHostImplTestHarness { … };
class NoVarySearchHeaderPrerenderHostTest
: public PrerenderHostTest,
public ::testing::WithParamInterface<bool> { … };
TEST_P(NoVarySearchHeaderPrerenderHostTest, IsNoVarySearchHeaderSet) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(PrerenderHostTest, Activate) { … }
TEST_F(PrerenderHostTest, DontActivate) { … }
TEST_F(PrerenderHostTest, MainFrameNavigationForReservedHost) { … }
TEST_F(PrerenderHostTest, ActivationAfterPageStateUpdate) { … }
TEST_F(PrerenderHostTest, LoadProgressChangedInvokedOnActivation) { … }
TEST_F(PrerenderHostTest, DontCancelPrerenderWhenTriggerGetsHidden) { … }
TEST_F(PrerenderHostTest, CancelActivationFromHiddenPage) { … }
TEST_F(PrerenderHostTest, DontCancelPrerenderWhenTriggerGetsVisible) { … }
#if !BUILDFLAG(IS_ANDROID)
TEST_F(PrerenderHostTest, DontCancelPrerenderWhenTriggerGetsOcculded) { … }
#endif
TEST_F(PrerenderHostTest, UrlMatchPredicate) { … }
TEST_F(PrerenderHostTest, CanceledPrerenderCannotBeReadyForActivation) { … }
TEST(AreHttpRequestHeadersCompatible, IgnoreRTT) { … }
}
}