chromium/chrome/browser/preloading/prefetch/no_state_prefetch/no_state_prefetch_test_utils.cc

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

#include "chrome/browser/preloading/prefetch/no_state_prefetch/no_state_prefetch_test_utils.h"

#include <memory>
#include <set>
#include <string>
#include <utility>
#include <vector>

#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/preloading/prefetch/no_state_prefetch/chrome_no_state_prefetch_contents_delegate.h"
#include "chrome/browser/preloading/prefetch/no_state_prefetch/no_state_prefetch_manager_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/no_state_prefetch/browser/no_state_prefetch_manager.h"
#include "components/prefs/pref_service.h"
#include "components/safe_browsing/core/browser/db/v4_protocol_manager_util.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "net/base/load_flags.h"
#include "net/test/embedded_test_server/default_handlers.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/request_handler_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/chrome_debug_urls.h"
#include "ui/base/l10n/l10n_util.h"

BrowserThread;
RenderViewHost;

namespace prerender {

namespace test_utils {

namespace {

// An ExternalProtocolHandler that blocks everything and asserts it never is
// called.
class NeverRunsExternalProtocolHandlerDelegate
    : public ExternalProtocolHandler::Delegate {};

}  // namespace

constexpr char kSecondaryDomain[] =;

TestNoStatePrefetchContents::TestNoStatePrefetchContents(
    NoStatePrefetchManager* no_state_prefetch_manager,
    content::BrowserContext* browser_context,
    const GURL& url,
    const content::Referrer& referrer,
    const std::optional<url::Origin>& initiator_origin,
    Origin origin,
    FinalStatus expected_final_status,
    bool ignore_final_status)
    :{}

TestNoStatePrefetchContents::~TestNoStatePrefetchContents() {}

bool TestNoStatePrefetchContents::CheckURL(const GURL& url) {}

void TestNoStatePrefetchContents::RenderFrameHostChanged(
    content::RenderFrameHost* old_frame_host,
    content::RenderFrameHost* new_frame_host) {}

void TestNoStatePrefetchContents::RenderWidgetHostVisibilityChanged(
    content::RenderWidgetHost* widget_host,
    bool became_visible) {}

void TestNoStatePrefetchContents::RenderWidgetHostDestroyed(
    content::RenderWidgetHost* widget_host) {}

DestructionWaiter::DestructionWaiter(
    TestNoStatePrefetchContents* no_state_prefetch_contents,
    FinalStatus expected_final_status)
    :{}

DestructionWaiter::~DestructionWaiter() {}

bool DestructionWaiter::WaitForDestroy() {}

void DestructionWaiter::MarkDestruction(FinalStatus reason) {}

DestructionWaiter::DestructionMarker::DestructionMarker(
    DestructionWaiter* waiter)
    :{}

DestructionWaiter::DestructionMarker::~DestructionMarker() {}

void DestructionWaiter::DestructionMarker::OnPrefetchStop(
    NoStatePrefetchContents* contents) {}

TestPrerender::TestPrerender()
    :{}

TestPrerender::~TestPrerender() {}

FinalStatus TestPrerender::GetFinalStatus() const {}

void TestPrerender::WaitForCreate() {}

void TestPrerender::WaitForStart() {}

void TestPrerender::WaitForStop() {}

void TestPrerender::WaitForLoads(int expected_number_of_loads) {}

void TestPrerender::OnPrefetchContentsCreated(
    TestNoStatePrefetchContents* contents) {}

void TestPrerender::OnPrefetchStart(NoStatePrefetchContents* contents) {}

void TestPrerender::OnPrefetchStopLoading(NoStatePrefetchContents* contents) {}

void TestPrerender::OnPrefetchStop(NoStatePrefetchContents* contents) {}

// static
FirstContentfulPaintManagerWaiter* FirstContentfulPaintManagerWaiter::Create(
    NoStatePrefetchManager* manager) {}

FirstContentfulPaintManagerWaiter::FirstContentfulPaintManagerWaiter()
    :{}

FirstContentfulPaintManagerWaiter::~FirstContentfulPaintManagerWaiter() {}

void FirstContentfulPaintManagerWaiter::OnFirstContentfulPaint() {}

void FirstContentfulPaintManagerWaiter::Wait() {}

TestNoStatePrefetchContentsFactory::TestNoStatePrefetchContentsFactory() {}

TestNoStatePrefetchContentsFactory::~TestNoStatePrefetchContentsFactory() {}

std::unique_ptr<TestPrerender>
TestNoStatePrefetchContentsFactory::ExpectNoStatePrefetchContents(
    FinalStatus final_status) {}

void TestNoStatePrefetchContentsFactory::IgnoreNoStatePrefetchContents() {}

NoStatePrefetchContents*
TestNoStatePrefetchContentsFactory::CreateNoStatePrefetchContents(
    std::unique_ptr<NoStatePrefetchContentsDelegate> delegate,
    NoStatePrefetchManager* no_state_prefetch_manager,
    content::BrowserContext* browser_context,
    const GURL& url,
    const content::Referrer& referrer,
    const std::optional<url::Origin>& initiator_origin,
    Origin origin) {}

TestNoStatePrefetchContentsFactory::ExpectedContents::ExpectedContents() {}

TestNoStatePrefetchContentsFactory::ExpectedContents::ExpectedContents(
    const ExpectedContents& other) = default;

TestNoStatePrefetchContentsFactory::ExpectedContents::ExpectedContents(
    FinalStatus final_status,
    const base::WeakPtr<TestPrerender>& handle)
    :{}

TestNoStatePrefetchContentsFactory::ExpectedContents::ExpectedContents(
    bool ignore)
    :{}

TestNoStatePrefetchContentsFactory::ExpectedContents::~ExpectedContents() {}

PrerenderInProcessBrowserTest::PrerenderInProcessBrowserTest()
    :{}

PrerenderInProcessBrowserTest::~PrerenderInProcessBrowserTest() {}

void PrerenderInProcessBrowserTest::TearDownInProcessBrowserTestFixture() {}

content::SessionStorageNamespace*
PrerenderInProcessBrowserTest::GetSessionStorageNamespace() const {}

std::string PrerenderInProcessBrowserTest::MakeAbsolute(
    const std::string& path) {}

bool PrerenderInProcessBrowserTest::UrlIsInNoStatePrefetchManager(
    const std::string& html_file) const {}

bool PrerenderInProcessBrowserTest::UrlIsInNoStatePrefetchManager(
    const GURL& url) const {}

content::WebContents* PrerenderInProcessBrowserTest::GetActiveWebContents()
    const {}

NoStatePrefetchManager*
PrerenderInProcessBrowserTest::GetNoStatePrefetchManager() const {}

TestNoStatePrefetchContents*
PrerenderInProcessBrowserTest::GetNoStatePrefetchContentsFor(
    const GURL& url) const {}

net::EmbeddedTestServer* PrerenderInProcessBrowserTest::src_server() {}

safe_browsing::FakeSafeBrowsingDatabaseManager*
PrerenderInProcessBrowserTest::GetFakeSafeBrowsingDatabaseManager() {}

void PrerenderInProcessBrowserTest::CreatedBrowserMainParts(
    content::BrowserMainParts* browser_main_parts) {}

void PrerenderInProcessBrowserTest::SetUpOnMainThread() {}

void PrerenderInProcessBrowserTest::UseHttpsSrcServer() {}

std::u16string PrerenderInProcessBrowserTest::MatchTaskManagerTab(
    const char* page_title) {}

std::u16string PrerenderInProcessBrowserTest::MatchTaskManagerPrerender(
    const char* page_title) {}

GURL PrerenderInProcessBrowserTest::GetURLWithReplacement(
    const std::string& url_file,
    const std::string& replacement_variable,
    const std::string& replacement_text) {}

std::vector<std::unique_ptr<TestPrerender>>
PrerenderInProcessBrowserTest::NavigateWithPrerenders(
    const GURL& loader_url,
    const std::vector<FinalStatus>& expected_final_status_queue) {}

GURL PrerenderInProcessBrowserTest::ServeLoaderURL(
    const std::string& loader_path,
    const std::string& replacement_variable,
    const GURL& url_to_prerender,
    const std::string& loader_query,
    const std::string& hostname_alternative) {}

GURL PrerenderInProcessBrowserTest::ServeLoaderURLWithHostname(
    const std::string& loader_path,
    const std::string& replacement_variable,
    const GURL& url_to_prerender,
    const std::string& loader_query,
    const std::string& hostname) {}

void PrerenderInProcessBrowserTest::MonitorResourceRequest(
    const net::test_server::HttpRequest& request) {}

uint32_t PrerenderInProcessBrowserTest::GetRequestCount(const GURL& url) {}

void PrerenderInProcessBrowserTest::WaitForRequestCount(
    const GURL& url,
    uint32_t expected_count) {}

}  // namespace test_utils

}  // namespace prerender