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

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: init 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
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 04ec96cf5c6f4a50e1cd9e1c309eaf7f537e0ac6..279346f5998f85bdac76ad9f1d4f20521f208500 100644
--- a/chrome/browser/search_engines/template_url_service_sync_unittest.cc
+++ b/chrome/browser/search_engines/template_url_service_sync_unittest.cc
@@ -1516,3 +1516,24 @@ TEST_F(TemplateURLServiceSyncTest, DeleteBogusData) {
EXPECT_EQ(SyncChange::ACTION_DELETE,
processor()->change_for_guid(std::string()).change_type());
}
+
+TEST_F(TemplateURLServiceSyncTest, PreSyncDeletes) {
+ model()->AddPreSyncDeletedGUIDForTesting("key1");
+ model()->AddPreSyncDeletedGUIDForTesting("key2");
+ model()->AddPreSyncDeletedGUIDForTesting("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"));
+}
Peter Kasting 2012/05/15 21:28:10 Can we also explicitly check that a pre-sync delet
SteveT 2012/05/16 13:26:43 I believe that is done with the "aaa" case. See li

Powered by Google App Engine
This is Rietveld 408576698