Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3827)

Unified Diff: chrome/browser/search_engines/template_url_service_unittest.cc

Issue 2347973002: Enable Chrome to tweak search engines for some locales (Closed)
Patch Set: pkasting's additional comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search_engines/template_url_service_unittest.cc
diff --git a/chrome/browser/search_engines/template_url_service_unittest.cc b/chrome/browser/search_engines/template_url_service_unittest.cc
index fb3369b734a628460ae5b5fe7eb7863b28f62dad..d1d82f7925a3a970c9f07b38da52c146a0865b62 100644
--- a/chrome/browser/search_engines/template_url_service_unittest.cc
+++ b/chrome/browser/search_engines/template_url_service_unittest.cc
@@ -73,7 +73,8 @@ std::unique_ptr<TemplateURL> CreateKeywordWithDate(
bool show_in_default_list,
const std::string& encodings,
Time date_created,
- Time last_modified) {
+ Time last_modified,
+ TemplateURL::Type type = TemplateURL::NORMAL) {
TemplateURLData data;
data.SetShortName(base::UTF8ToUTF16(short_name));
data.SetKeyword(base::UTF8ToUTF16(keyword));
@@ -88,7 +89,7 @@ std::unique_ptr<TemplateURL> CreateKeywordWithDate(
encodings, ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
data.date_created = date_created;
data.last_modified = last_modified;
- return base::MakeUnique<TemplateURL>(data);
+ return base::MakeUnique<TemplateURL>(data, type);
}
TemplateURL* AddKeywordWithDate(
@@ -834,7 +835,7 @@ TEST_F(TemplateURLServiceTest, RepairPrepopulatedSearchEngines) {
// Bing was repaired.
bing = model()->GetTemplateURLForKeyword(ASCIIToUTF16("bing.com"));
ASSERT_TRUE(bing);
- EXPECT_EQ(TemplateURL::NORMAL, bing->GetType());
+ EXPECT_EQ(TemplateURL::NORMAL, bing->type());
// User search engine is preserved.
EXPECT_EQ(user_dse, model()->GetTemplateURLForHost("www.goo.com"));
@@ -1415,10 +1416,9 @@ TEST_F(TemplateURLServiceTest, DefaultExtensionEngine) {
std::unique_ptr<TemplateURL> ext_dse = CreateKeywordWithDate(
model(), "ext", "ext", "http://www.search.com/s?q={searchTerms}",
std::string(), std::string(), std::string(), true, true, "UTF-8", Time(),
- Time());
+ Time(), TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION);
std::unique_ptr<TemplateURL::AssociatedExtensionInfo> extension_info(
- new TemplateURL::AssociatedExtensionInfo(
- TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, "ext"));
+ new TemplateURL::AssociatedExtensionInfo("ext"));
extension_info->wants_to_be_default_engine = true;
TemplateURL* ext_dse_ptr = model()->AddExtensionControlledTURL(
std::move(ext_dse), std::move(extension_info));
@@ -1442,21 +1442,19 @@ TEST_F(TemplateURLServiceTest, ExtensionEnginesNotPersist) {
std::unique_ptr<TemplateURL> ext_dse = CreateKeywordWithDate(
model(), "ext1", "ext1", "http://www.ext1.com/s?q={searchTerms}",
std::string(), std::string(), std::string(), true, false, "UTF-8", Time(),
- Time());
+ Time(), TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION);
std::unique_ptr<TemplateURL::AssociatedExtensionInfo> extension_info(
- new TemplateURL::AssociatedExtensionInfo(
- TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, "ext1"));
+ new TemplateURL::AssociatedExtensionInfo("ext1"));
extension_info->wants_to_be_default_engine = false;
model()->AddExtensionControlledTURL(std::move(ext_dse),
std::move(extension_info));
EXPECT_EQ(user_dse, model()->GetDefaultSearchProvider());
- ext_dse = CreateKeywordWithDate(model(), "ext2", "ext2",
- "http://www.ext2.com/s?q={searchTerms}",
- std::string(), std::string(), std::string(),
- true, true, "UTF-8", Time(), Time());
- extension_info.reset(new TemplateURL::AssociatedExtensionInfo(
- TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, "ext2"));
+ ext_dse = CreateKeywordWithDate(
+ model(), "ext2", "ext2", "http://www.ext2.com/s?q={searchTerms}",
+ std::string(), std::string(), std::string(), true, true, "UTF-8", Time(),
+ Time(), TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION);
+ extension_info.reset(new TemplateURL::AssociatedExtensionInfo("ext2"));
extension_info->wants_to_be_default_engine = true;
TemplateURL* ext_dse_ptr = model()->AddExtensionControlledTURL(
std::move(ext_dse), std::move(extension_info));
@@ -1502,10 +1500,9 @@ TEST_F(TemplateURLServiceTest, ExtensionEngineVsPolicy) {
std::unique_ptr<TemplateURL> ext_dse = CreateKeywordWithDate(
model(), "ext1", "ext1", "http://www.ext1.com/s?q={searchTerms}",
std::string(), std::string(), std::string(), true, true, "UTF-8", Time(),
- Time());
+ Time(), TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION);
std::unique_ptr<TemplateURL::AssociatedExtensionInfo> extension_info(
- new TemplateURL::AssociatedExtensionInfo(
- TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, "ext1"));
+ new TemplateURL::AssociatedExtensionInfo("ext1"));
extension_info->wants_to_be_default_engine = true;
TemplateURL* ext_dse_ptr = model()->AddExtensionControlledTURL(
std::move(ext_dse), std::move(extension_info));

Powered by Google App Engine
This is Rietveld 408576698