chromium/chrome/browser/search_engine_choice/search_engine_choice_dialog_service_unittest.cc

// Copyright 2023 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/search_engine_choice/search_engine_choice_dialog_service.h"

#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/metrics/user_action_tester.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/profiles/profile.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/test/base/browser_with_test_window_test.h"
#include "chrome/test/base/dialog_test_browser_window.h"
#include "chrome/test/base/testing_browser_process.h"
#include "components/country_codes/country_codes.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_engine_utils.h"
#include "components/search_engines/search_engines_pref_names.h"
#include "components/search_engines/search_engines_switches.h"
#include "components/search_engines/template_url_prepopulate_data.h"
#include "components/search_engines/template_url_service.h"
#include "components/signin/public/base/signin_switches.h"
#include "components/web_modal/test_web_contents_modal_dialog_host.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

#if !BUILDFLAG(CHROME_FOR_TESTING)
void SetUserSelectedDefaultSearchProvider(
    TemplateURLService* template_url_service,
    bool created_by_policy) {}

struct TestParam {};

// To be passed as 4th argument to `INSTANTIATE_TEST_SUITE_P()`, allows the test
// to be named like `<TestClassName>.InvokeUi_default/<TestSuffix>` instead
// of using the index of the param in `TestParam` as suffix.
std::string ParamToTestSuffix(const ::testing::TestParamInfo<TestParam>& info) {}

// Permutations of supported parameters.
const TestParam kTestParams[] =;
#endif

// Custom test browser window to provide a parent view to a modal dialog.
class ResizableDialogTestBrowserWindow : public DialogTestBrowserWindow {};

}  // namespace

class SearchEngineChoiceDialogServiceTest : public BrowserWithTestWindowTest {};

#if !BUILDFLAG(CHROME_FOR_TESTING)
class SearchEngineListCountryOverrideParametrizedTest
    : public SearchEngineChoiceDialogServiceTest,
      public testing::WithParamInterface<TestParam> {};

INSTANTIATE_TEST_SUITE_P();

TEST_F(SearchEngineChoiceDialogServiceTest, NotifyLearnMoreLinkClicked) {}

TEST_F(SearchEngineChoiceDialogServiceTest, NotifyMoreButtonClicked) {}

TEST_F(SearchEngineChoiceDialogServiceTest,
       ComputeDialogConditions_SmallBrowser) {}

TEST_F(SearchEngineChoiceDialogServiceTest, RegisterDialog) {}

TEST_F(SearchEngineChoiceDialogServiceTest, NotifyChoiceMade_Dialog) {}

TEST_F(SearchEngineChoiceDialogServiceTest, NotifyChoiceMade_Fre) {}

TEST_F(SearchEngineChoiceDialogServiceTest, NotifyChoiceMade_ProfileCreation) {}

TEST_F(SearchEngineChoiceDialogServiceTest,
       DoNotDisplayDialogIfPolicyIsSetDynamically) {}

TEST_F(SearchEngineChoiceDialogServiceTest, DoNotCreateServiceIfPolicyIsSet) {}

TEST_F(SearchEngineChoiceDialogServiceTest,
       SearchEngineChoicePropagatesFromParentProfileToIncognito) {}

TEST_F(SearchEngineChoiceDialogServiceTest,
       SearchEngineChoicePropagatesFromIncognitoToParentProfile) {}

TEST_F(SearchEngineChoiceDialogServiceTest, IsUrlSuitableForDialog) {}

TEST_F(SearchEngineChoiceDialogServiceTest,
       CanSuppressPrivacySandboxPromo_Dialog) {}

TEST_F(SearchEngineChoiceDialogServiceTest,
       CanSuppressPrivacySandboxPromo_FRE) {}

TEST_F(SearchEngineChoiceDialogServiceTest,
       CanSuppressPrivacySandboxPromo_ProfileCreation) {}

TEST_P(SearchEngineListCountryOverrideParametrizedTest,
       CheckNumberOfSearchEngines) {}

#else
TEST_F(SearchEngineChoiceDialogServiceTest,
       ServiceNotInitializedInChromeForTesting) {
  SearchEngineChoiceDialogService* search_engine_choice_dialog_service =
      GetSearchEngineChoiceDialogService();
  ASSERT_EQ(search_engine_choice_dialog_service, nullptr);
}
#endif