chromium/chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_browser_test_base.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 "chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_browser_test_base.h"

#include "base/containers/adapters.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/devtools/devtools_window_testing.h"
#include "chrome/browser/preloading/chrome_preloading.h"
#include "chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_request.h"
#include "chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_service.h"
#include "chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/search_test_utils.h"
#include "components/search_engines/template_url_service.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/browsing_data_filter_builder.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/browsing_data_remover_test_util.h"
#include "net/dns/mock_host_resolver.h"
#include "net/http/http_status_code.h"
#include "net/test/embedded_test_server/http_response.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace {

constexpr char kSuggestDomain[] =;
constexpr char16_t kSuggestDomain16[] =;
constexpr char kSearchDomain[] =;
constexpr char16_t kSearchDomain16[] =;
constexpr char kClientHintsURL[] =;
constexpr char kLoadInSubframe[] =;

}  // namespace

SearchPrefetchBaseBrowserTest::SearchPrefetchBaseBrowserTest() {}

SearchPrefetchBaseBrowserTest::~SearchPrefetchBaseBrowserTest() = default;

void SearchPrefetchBaseBrowserTest::SetUpOnMainThread() {}

void SearchPrefetchBaseBrowserTest::SetUpInProcessBrowserTestFixture() {}

void SearchPrefetchBaseBrowserTest::TearDownInProcessBrowserTestFixture() {}

void SearchPrefetchBaseBrowserTest::SetUpCommandLine(base::CommandLine* cmd) {}

GURL SearchPrefetchBaseBrowserTest::GetSearchServerQueryURL(
    const std::string& path) const {}

GURL SearchPrefetchBaseBrowserTest::GetSearchServerQueryURLWithNoQuery(
    const std::string& path) const {}

GURL SearchPrefetchBaseBrowserTest::GetCanonicalSearchURL(
    const GURL& prefetch_url) {}

GURL SearchPrefetchBaseBrowserTest::GetSearchServerQueryURLWithSubframeLoad(
    const std::string& path) const {}

GURL SearchPrefetchBaseBrowserTest::GetSuggestServerURL(
    const std::string& path) const {}

std::tuple<GURL, GURL>
SearchPrefetchBaseBrowserTest::GetSearchPrefetchAndNonPrefetch(
    const std::string& search_terms) {}

void SearchPrefetchBaseBrowserTest::WaitUntilStatusChangesTo(
    const GURL& canonical_search_url,
    std::optional<SearchPrefetchStatus> status) {}

GURL SearchPrefetchBaseBrowserTest::GetRealPrefetchUrlForTesting(
    const GURL& canonical_search_url) {}

content::WebContents* SearchPrefetchBaseBrowserTest::GetWebContents() const {}

std::string SearchPrefetchBaseBrowserTest::GetDocumentInnerHTML() const {}

void SearchPrefetchBaseBrowserTest::WaitForDuration(base::TimeDelta duration) {}

void SearchPrefetchBaseBrowserTest::ClearBrowsingCacheData(
    std::optional<GURL> url_origin) {}

void SearchPrefetchBaseBrowserTest::SetDSEWithURL(const GURL& url,
                                                  bool dse_allows_prefetch) {}

// This is sufficient to cause observer calls about updated template URL, but
// doesn't change DSE at all.
void SearchPrefetchBaseBrowserTest::UpdateButChangeNothingInDSE() {}

void SearchPrefetchBaseBrowserTest::OpenDevToolsWindow(
    content::WebContents* tab) {}

void SearchPrefetchBaseBrowserTest::CloseDevToolsWindow() {}

void SearchPrefetchBaseBrowserTest::RegisterStaticFile(
    const std::string& relative_url,
    const std::string& content,
    const std::string& content_type) {}

void SearchPrefetchBaseBrowserTest::AddNewSuggestionRule(
    std::string origin_query,
    std::vector<std::string> suggestions,
    int prefetch_index,
    int prerender_index) {}

std::unique_ptr<net::test_server::HttpResponse>
SearchPrefetchBaseBrowserTest::HandleSearchRequest(
    const net::test_server::HttpRequest& request) {}

void SearchPrefetchBaseBrowserTest::MonitorSearchResourceRequestOnUIThread(
    net::test_server::HttpRequest request,
    bool has_prefetch_header) {}

std::unique_ptr<net::test_server::HttpResponse>
SearchPrefetchBaseBrowserTest::HandleSearchSuggestRequest(
    const net::test_server::HttpRequest& request) {}

SearchPrefetchBaseBrowserTest::SearchSuggestionTuple::SearchSuggestionTuple(
    std::string origin_query,
    std::vector<std::string> suggestions,
    int prefetch_index,
    int prerender_index)
    :{}

SearchPrefetchBaseBrowserTest::SearchSuggestionTuple::~SearchSuggestionTuple() =
    default;

SearchPrefetchBaseBrowserTest::SearchSuggestionTuple::SearchSuggestionTuple(
    const SearchSuggestionTuple& other) = default;

AutocompleteMatch SearchPrefetchBaseBrowserTest::CreateSearchSuggestionMatch(
    const std::string& original_query,
    const std::string& search_terms,
    bool prefetch_hint) {}