#include <string>
#include <string_view>
#include "base/containers/adapters.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/path_service.h"
#include "base/ranges/algorithm.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "build/build_config.h"
#include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
#include "chrome/browser/browser_features.h"
#include "chrome/browser/predictors/autocomplete_action_predictor.h"
#include "chrome/browser/predictors/autocomplete_action_predictor_factory.h"
#include "chrome/browser/preloading/chrome_preloading.h"
#include "chrome/browser/preloading/prefetch/search_prefetch/field_trial_settings.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/preloading/prerender/prerender_manager.h"
#include "chrome/browser/preloading/prerender/prerender_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/test_safe_browsing_navigation_observer_manager.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/location_bar/location_bar.h"
#include "chrome/browser/ui/omnibox/omnibox_tab_helper.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/chrome_test_utils.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/search_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/omnibox/browser/base_search_provider.h"
#include "components/omnibox/browser/omnibox_controller.h"
#include "components/omnibox/browser/omnibox_edit_model.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/search_engines/template_url_data.h"
#include "components/search_engines/template_url_service.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/content_features.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/navigation_handle_observer.h"
#include "content/public/test/preloading_test_util.h"
#include "content/public/test/prerender_test_util.h"
#include "content/public/test/test_navigation_observer.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
namespace {
UkmEntry;
Preloading_Attempt;
Preloading_Prediction;
static const auto kMockElapsedTime = …;
content::PreloadingFailureReason ToPreloadingFailureReason(
PrerenderPredictionStatus status) { … }
class AutocompleteActionPredictorObserverImpl
: public predictors::AutocompleteActionPredictor::Observer { … };
class PrerenderOmniboxUIBrowserTest : public InProcessBrowserTest,
public content::WebContentsObserver { … };
IN_PROC_BROWSER_TEST_F(PrerenderOmniboxUIBrowserTest,
PrerenderingByAutocompleteActionPredictorCanActivate) { … }
IN_PROC_BROWSER_TEST_F(PrerenderOmniboxUIBrowserTest,
CancelAutocompleteActionPredictorOldPrerendering) { … }
IN_PROC_BROWSER_TEST_F(PrerenderOmniboxUIBrowserTest,
AutocompleteActionPredictorWrongPrediction) { … }
IN_PROC_BROWSER_TEST_F(PrerenderOmniboxUIBrowserTest,
AutocompleteActionPredictorSameURL) { … }
class PrerenderPreloaderHoldbackBrowserTest
: public PrerenderOmniboxUIBrowserTest { … };
IN_PROC_BROWSER_TEST_F(PrerenderPreloaderHoldbackBrowserTest,
PrerenderHoldbackTest) { … }
IN_PROC_BROWSER_TEST_F(PrerenderOmniboxUIBrowserTest,
NavigationHandleIsRendererInitiatedFalse) { … }
IN_PROC_BROWSER_TEST_F(PrerenderOmniboxUIBrowserTest,
SameUrlPrerenderingCanBeUsedAgainAfterActivation) { … }
class PrerenderOmniboxSearchSuggestionUIBrowserTest
: public PrerenderOmniboxUIBrowserTest { … };
IN_PROC_BROWSER_TEST_F(PrerenderOmniboxSearchSuggestionUIBrowserTest,
DISABLED_DifferentSuggestion) { … }
class PrerenderOmniboxReferrerChainUIBrowserTest
: public PrerenderOmniboxUIBrowserTest { … };
IN_PROC_BROWSER_TEST_F(PrerenderOmniboxReferrerChainUIBrowserTest,
PrerenderHasNoInitiator) { … }
}