Index: chrome/browser/search_engines/template_url_service_sync_unittest.cc |
diff --git a/chrome/browser/search_engines/template_url_service_sync_unittest.cc b/chrome/browser/search_engines/template_url_service_sync_unittest.cc |
index 86ce43c429526afe7c220b43a9fb521a362f0d30..c2f01f3fe682c05729c6945de26347825d714bd1 100644 |
--- a/chrome/browser/search_engines/template_url_service_sync_unittest.cc |
+++ b/chrome/browser/search_engines/template_url_service_sync_unittest.cc |
@@ -415,7 +415,7 @@ TEST_F(TemplateURLServiceSyncTest, GetAllSyncDataBasic) { |
} |
} |
-TEST_F(TemplateURLServiceSyncTest, GetAllSyncDataNoExtensions) { |
+TEST_F(TemplateURLServiceSyncTest, GetAllSyncDataWithExtension) { |
model()->Add(CreateTestTemplateURL(ASCIIToUTF16("key1"), "http://key1.com")); |
model()->Add(CreateTestTemplateURL(ASCIIToUTF16("key2"), "http://key2.com")); |
model()->Add(CreateTestTemplateURL(ASCIIToUTF16("key3"), |
@@ -423,7 +423,7 @@ TEST_F(TemplateURLServiceSyncTest, GetAllSyncDataNoExtensions) { |
syncer::SyncDataList all_sync_data = |
model()->GetAllSyncData(syncer::SEARCH_ENGINES); |
- EXPECT_EQ(2U, all_sync_data.size()); |
+ EXPECT_EQ(3U, all_sync_data.size()); |
for (syncer::SyncDataList::const_iterator iter = all_sync_data.begin(); |
iter != all_sync_data.end(); ++iter) { |
@@ -1083,14 +1083,15 @@ TEST_F(TemplateURLServiceSyncTest, ProcessChangesWithLocalExtensions) { |
CreateInitialSyncData(), PassProcessor(), |
CreateAndPassSyncErrorFactory()); |
- // Add some extension keywords locally. These shouldn't be synced. |
+ // Add some extension keywords locally. |
TemplateURL* extension1 = CreateTestTemplateURL(ASCIIToUTF16("keyword1"), |
std::string(extensions::kExtensionScheme) + "://extension1"); |
model()->Add(extension1); |
+ EXPECT_EQ(1U, processor()->change_list_size()); |
TemplateURL* extension2 = CreateTestTemplateURL(ASCIIToUTF16("keyword2"), |
std::string(extensions::kExtensionScheme) + "://extension2"); |
model()->Add(extension2); |
- EXPECT_EQ(0U, processor()->change_list_size()); |
+ EXPECT_EQ(1U, processor()->change_list_size()); |
// Create some sync changes that will conflict with the extension keywords. |
syncer::SyncChangeList changes; |
@@ -1101,25 +1102,20 @@ TEST_F(TemplateURLServiceSyncTest, ProcessChangesWithLocalExtensions) { |
CreateTestTemplateURL(ASCIIToUTF16("keyword2"), "http://bbb.com"))); |
model()->ProcessSyncChanges(FROM_HERE, changes); |
- // The synced keywords should be added unchanged, and the result of |
- // GetTemplateURLForKeyword() for each keyword should depend on whether the |
- // synced keyword is replaceable or not. |
- EXPECT_EQ(extension1, |
- model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword1"))); |
+ // The existing extension keywords should be uniquified. |
EXPECT_FALSE(model()->GetTemplateURLForHost("aaa.com") == NULL); |
+ EXPECT_EQ(model()->GetTemplateURLForHost("aaa.com"), |
+ model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword1"))); |
TemplateURL* url_for_keyword2 = |
model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword2")); |
EXPECT_NE(extension2, url_for_keyword2); |
EXPECT_EQ("http://bbb.com", url_for_keyword2->url()); |
- // Note that extensions don't use host-based keywords, so we can't check that |
- // |extension2| is still in the model using GetTemplateURLForHost(); and we |
- // have to create a full-fledged Extension to use |
- // GetTemplateURLForExtension(), which is annoying, so just grab all the URLs |
- // from the model and search for |extension2| within them. |
- TemplateURLService::TemplateURLVector template_urls( |
- model()->GetTemplateURLs()); |
- EXPECT_FALSE(std::find(template_urls.begin(), template_urls.end(), |
- extension2) == template_urls.end()); |
+ |
+ // Replaced extension keywords should be uniquified. |
+ EXPECT_EQ(extension1, |
+ model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword1_"))); |
+ EXPECT_EQ(extension2, |
+ model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword2_"))); |
} |
TEST_F(TemplateURLServiceSyncTest, AutogeneratedKeywordMigrated) { |