#include <memory>
#include "base/callback_list.h"
#include "base/check_deref.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/test_future.h"
#include "build/buildflag.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/browser/profiles/keep_alive/profile_keep_alive_types.h"
#include "chrome/browser/profiles/keep_alive/scoped_profile_keep_alive.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_test_util.h"
#include "chrome/browser/profiles/profile_window.h"
#include "chrome/browser/search_engine_choice/search_engine_choice_dialog_service.h"
#include "chrome/browser/search_engine_choice/search_engine_choice_dialog_service_factory.h"
#include "chrome/browser/search_engine_choice/search_engine_choice_service_factory.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/sessions/session_restore_test_helper.h"
#include "chrome/browser/sessions/session_service_factory.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
#include "chrome/browser/web_applications/test/os_integration_test_override_impl.h"
#include "chrome/browser/web_applications/test/web_app_install_test_utils.h"
#include "chrome/browser/web_applications/web_app_install_info.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/keep_alive_registry/keep_alive_types.h"
#include "components/keep_alive_registry/scoped_keep_alive.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/search_engines/default_search_manager.h"
#include "components/search_engines/prepopulated_engines.h"
#include "components/search_engines/search_engine_choice/search_engine_choice_utils.h"
#include "components/search_engines/search_engines_pref_names.h"
#include "components/search_engines/search_engines_switches.h"
#include "components/search_engines/search_engines_test_util.h"
#include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_prepopulate_data.h"
#include "components/search_engines/template_url_service.h"
#include "components/version_info/version_info.h"
#include "components/webapps/common/web_app_id.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/window_open_disposition.h"
_;
TestParamInfo;
ValuesIn;
WithParamInterface;
EntryPoint;
namespace {
class MockSearchEngineChoiceDialogService
: public SearchEngineChoiceDialogService { … };
webapps::AppId InstallPWA(Profile* profile, const GURL& start_url) { … }
}
class SearchEngineChoiceDialogBrowserTest : public InProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_F(SearchEngineChoiceDialogBrowserTest,
RestoreBrowserWithMultipleTabs) { … }
IN_PROC_BROWSER_TEST_F(SearchEngineChoiceDialogBrowserTest, BackgroundTab) { … }
IN_PROC_BROWSER_TEST_F(SearchEngineChoiceDialogBrowserTest,
RestoreSessionWithMultipleBrowsers) { … }
IN_PROC_BROWSER_TEST_F(SearchEngineChoiceDialogBrowserTest,
BrowserIsRemovedFromListAfterClose) { … }
IN_PROC_BROWSER_TEST_F(SearchEngineChoiceDialogBrowserTest,
DialogsOnBrowsersWithSameProfileCloseAfterMakingChoice) { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_F(SearchEngineChoiceDialogBrowserTest,
DialogGetsDisplayedForAllProfiles) { … }
#endif
IN_PROC_BROWSER_TEST_F(SearchEngineChoiceDialogBrowserTest,
PRE_DialogDoesNotShowAgainAfterSettingPref) { … }
IN_PROC_BROWSER_TEST_F(SearchEngineChoiceDialogBrowserTest,
DialogDoesNotShowAgainAfterSettingPref) { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_F(SearchEngineChoiceDialogBrowserTest,
DialogDoesNotOverlapWithProfileCustomizationDialog) { … }
#endif
IN_PROC_BROWSER_TEST_F(SearchEngineChoiceDialogBrowserTest,
DialogDoesNotShowWithExtensionEnabledThatOverridesDSE) { … }
IN_PROC_BROWSER_TEST_F(SearchEngineChoiceDialogBrowserTest,
DialogDoesNotShownForWebApp) { … }
IN_PROC_BROWSER_TEST_F(SearchEngineChoiceDialogBrowserTest,
DialogNotShownOverSpecificBrowserTypes) { … }
IN_PROC_BROWSER_TEST_F(SearchEngineChoiceDialogBrowserTest,
RecordingSearchEngineIsDoneAfterSettingDefault) { … }
#if !BUILDFLAG(IS_CHROMEOS)
IN_PROC_BROWSER_TEST_F(SearchEngineChoiceDialogBrowserTest,
DialogIsDisplayedOnEveryGuestSession) { … }
#endif
IN_PROC_BROWSER_TEST_F(SearchEngineChoiceDialogBrowserTest,
DialogNotShownForSmallHeightBrowserWindows) { … }
struct RepromptTestParam { … };
const RepromptTestParam kTestParams[] = …;
class SearchEngineRepromptBrowserTest
: public SearchEngineChoiceDialogBrowserTest,
public WithParamInterface<RepromptTestParam> { … };
IN_PROC_BROWSER_TEST_P(SearchEngineRepromptBrowserTest, PRE_Reprompt) { … }
IN_PROC_BROWSER_TEST_P(SearchEngineRepromptBrowserTest, Reprompt) { … }
INSTANTIATE_TEST_SUITE_P(…);