chromium/content/browser/preloading/prerenderer_impl_unittest.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/preloading/prerenderer_impl.h"

#include "base/test/scoped_feature_list.h"
#include "content/browser/preloading/preloading_confidence.h"
#include "content/browser/preloading/prerender/prerender_features.h"
#include "content/browser/preloading/prerender/prerender_host_registry.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/common/content_client.h"
#include "content/public/test/prerender_test_util.h"
#include "content/public/test/test_browser_context.h"
#include "content/public/test/test_renderer_host.h"
#include "content/test/test_content_browser_client.h"
#include "content/test/test_web_contents.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace content {
namespace {

class PrerendererTest : public RenderViewHostTestHarness {};

// Tests that Prerenderer starts prerendering when it receives prerender
// speculation candidates.
TEST_F(PrerendererTest, StartPrerender) {}

// Tests that Prerenderer should not start prerendering when
// kLCPTimingPredictorPrerender2 is enabled and until OnLCPPredicted is called.
TEST_F(PrerendererTest, LCPTimingPredictorPrerender2) {}

// Tests that Prerenderer will skip a cross-site candidate even if it is the
// first prerender candidate in the candidate list.
TEST_F(PrerendererTest, ProcessFirstSameOriginPrerenderCandidate) {}

class PrerenderHostRegistryObserver : public PrerenderHostRegistry::Observer {};

// Test that ProcessCandidatesForPrerender will trigger candidates in the same
// order as the input of the candidate list (crbug.com/1505301).
TEST_F(PrerendererTest, TriggerPrerenderWithInsertionOrder) {}

// Tests that Prerenderer will remove the rendered host, if the url is removed
// from candidates list.
TEST_F(PrerendererTest, RemoveRendererHostAfterCandidateRemoved) {}

class PrerendererNewLimitAndSchedulerTest : public PrerendererTest {};

// Tests that Prerenderer will remove the host if the host is canceled with
// non-eager limit, and the canceled host can be reprocessed.
TEST_F(PrerendererNewLimitAndSchedulerTest,
       RemoveRendererHostAfterNonEagerLimitCancel) {}

// Tests that it is possible to start a prerender using MaybePrerender and
// ShouldWaitForPrerenderResult methods.
TEST_F(PrerendererTest, MaybePrerenderAndShouldWaitForPrerenderResult) {}

}  // namespace
}  // namespace content