chromium/components/search_engines/template_url_service_util_unittest.cc

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

#include <stddef.h>

#include <memory>

#include "base/files/scoped_temp_dir.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/values.h"
#include "components/country_codes/country_codes.h"
#include "components/search_engines/keyword_web_data_service.h"
#include "components/search_engines/prepopulated_engines.h"
#include "components/search_engines/search_engine_choice/search_engine_choice_service.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_environment.h"
#include "components/search_engines/search_terms_data.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/search_engines/template_url_starter_pack_data.h"
#include "components/search_engines/util.h"
#include "components/webdata/common/web_database_service.h"
#include "components/webdata/common/webdata_constants.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

std::unique_ptr<TemplateURLData> CreatePrepopulateTemplateURLData(
    int prepopulate_id,
    const std::string& keyword) {}

// Creates a TemplateURL with default values except for the prepopulate ID,
// keyword and TemplateURLID. Only use this in tests if your tests do not
// care about other fields.
std::unique_ptr<TemplateURL> CreatePrepopulateTemplateURL(
    int prepopulate_id,
    const std::string& keyword,
    TemplateURLID id,
    bool is_play_api_turl = false) {}

// Sets up dependencies and calls `GetSearchProvidersUsingLoadedEngines()`.
// As with the wrapped function, `template_urls` will be updated with the loaded
// engines, including the starter pack ones, and `*resource_keyword_version`
// will be set to the version number for the loaded data or to 0 if no
// prepopulated engines were loaded.
void CallGetSearchProvidersUsingLoadedEngines(
    PrefService* prefs,
    search_engines::SearchEngineChoiceService* search_engine_choice_service,
    TemplateURLService::OwnedTemplateURLVector* template_urls,
    WDKeywordsResult::Metadata& inout_resource_metadata) {}

}  // namespace

TEST(TemplateURLServiceUtilTest, RemoveDuplicatePrepopulateIDs) {}

// Tests correct interaction of Play API search engine during prepopulated list
// update.
TEST(TemplateURLServiceUtilTest, MergeEnginesFromPrepopulateData_PlayAPI) {}

// Tests that user modified fields are preserved and overwritten appropriately
// in MergeIntoEngineData().
TEST(TemplateURLServiceUtilTest, MergeIntoEngineData) {}

class TemplateURLServiceUtilLoadTest : public testing::Test {};

TEST_F(TemplateURLServiceUtilLoadTest,
       GetSearchProvidersUsingLoadedEngines_choiceTriggerFeatureOff) {}

TEST_F(TemplateURLServiceUtilLoadTest,
       GetSearchProvidersUsingLoadedEngines_choiceTriggerFeatureOnOutOfEea) {}

TEST_F(TemplateURLServiceUtilLoadTest,
       GetSearchProvidersUsingLoadedEngines_choiceTriggerFeatureOnInEea) {}