#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/ui/search_engines/keyword_editor_controller.h"
#include <memory>
#include <string>
#include "base/compiler_specific.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_service_factory_test_util.h"
#include "chrome/browser/search_engines/template_url_service_test_util.h"
#include "chrome/browser/ui/search_engines/template_url_table_model.h"
#include "chrome/test/base/testing_profile.h"
#include "components/omnibox/common/omnibox_features.h"
#include "components/search_engines/choice_made_location.h"
#include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_data.h"
#include "components/search_engines/template_url_service.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/models/table_model_observer.h"
ASCIIToUTF16;
static const std::u16string kA(u"a");
static const std::u16string kA1(u"a1");
static const std::u16string kB(u"b");
static const std::u16string kB1(u"b1");
static const std::u16string kManaged(u"managed");
class KeywordEditorControllerTest : public testing::Test,
public ui::TableModelObserver { … };
class KeywordEditorControllerNoWebDataTest
: public KeywordEditorControllerTest { … };
class KeywordEditorControllerManagedDSPTest
: public KeywordEditorControllerTest { … };
TEST_F(KeywordEditorControllerTest, Add) { … }
TEST_F(KeywordEditorControllerTest, Modify) { … }
TEST_F(KeywordEditorControllerTest, MakeDefault) { … }
TEST_F(KeywordEditorControllerManagedDSPTest, CannotSetDefaultWhileManaged) { … }
TEST_F(KeywordEditorControllerManagedDSPTest, SetDefaultWhileRecommended) { … }
TEST_F(KeywordEditorControllerManagedDSPTest, UpdateRecommended) { … }
TEST_F(KeywordEditorControllerManagedDSPTest, SetManagedWhileRecommended) { … }
TEST_F(KeywordEditorControllerManagedDSPTest, EditManagedDefault) { … }
TEST_F(KeywordEditorControllerManagedDSPTest, EditRecommendedDefault) { … }
TEST_F(KeywordEditorControllerNoWebDataTest, MakeDefaultNoWebData) { … }
TEST_F(KeywordEditorControllerTest, MutateTemplateURLService) { … }
struct SearchEngineOrderingTestCase { … };
std::unique_ptr<TemplateURL> CreateTemplateUrlForSortingTest(
SearchEngineOrderingTestCase test_case) { … }
TEST_F(KeywordEditorControllerTest, EnginesSortedByName) { … }
TEST_F(KeywordEditorControllerTest, EnginesSortedByNameWithManagedSiteSearch) { … }
TEST_F(KeywordEditorControllerTest, FeaturedEnterpriseSiteSearch) { … }
TEST_F(KeywordEditorControllerTest,
EnterpriseSiteSearchConflictWithExistingEngines) { … }