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

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

Issue 10384188: Ensure that TemplateURLs removed by prepopulate search engine merging is also removed from Sync. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: removed AddPreSyncDeletedGUIDForTesting; test empty set; merge to TOT Created 8 years, 7 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
« no previous file with comments | « chrome/browser/search_engines/template_url_service.cc ('k') | chrome/browser/search_engines/util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 dfe9f11a4efbac64c1b39804d98d97ecbfe39f41..b29d1f56e6575f38b368483428e2a6990347cc94 100644
--- a/chrome/browser/search_engines/template_url_service_sync_unittest.cc
+++ b/chrome/browser/search_engines/template_url_service_sync_unittest.cc
@@ -1530,3 +1530,27 @@ TEST_F(TemplateURLServiceSyncTest, DeleteBogusData) {
EXPECT_EQ(SyncChange::ACTION_DELETE,
processor()->change_for_guid(std::string()).change_type());
}
+
+TEST_F(TemplateURLServiceSyncTest, PreSyncDeletes) {
+ model()->pre_sync_deletes_.insert("key1");
+ model()->pre_sync_deletes_.insert("key2");
+ model()->pre_sync_deletes_.insert("aaa");
+ model()->Add(CreateTestTemplateURL(ASCIIToUTF16("whatever"),
+ "http://key1.com", "bbb"));
+ model()->MergeDataAndStartSyncing(syncable::SEARCH_ENGINES,
+ CreateInitialSyncData(), PassProcessor(),
+ CreateAndPassSyncErrorFactory());
+
+ // We expect the model to have GUIDs {bbb, key3} after our initial merge.
+ EXPECT_TRUE(model()->GetTemplateURLForGUID("bbb"));
+ EXPECT_TRUE(model()->GetTemplateURLForGUID("key3"));
+ SyncChange change = processor()->change_for_guid("key1");
+ EXPECT_EQ(SyncChange::ACTION_DELETE, change.change_type());
+ change = processor()->change_for_guid("key2");
+ EXPECT_EQ(SyncChange::ACTION_DELETE, change.change_type());
+ // "aaa" should have been pruned out on account of not being from Sync.
+ EXPECT_FALSE(processor()->contains_guid("aaa"));
+ // The set of pre-sync deletes should be cleared so they're not reused if
+ // MergeDataAndStartSyncing gets called again.
+ EXPECT_TRUE(model()->pre_sync_deletes_.empty());
+}
« no previous file with comments | « chrome/browser/search_engines/template_url_service.cc ('k') | chrome/browser/search_engines/util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698