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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/search_engines/search_terms_data.h" 9 #include "chrome/browser/search_engines/search_terms_data.h"
10 #include "chrome/browser/search_engines/template_url.h" 10 #include "chrome/browser/search_engines/template_url.h"
(...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 // deletion. 1523 // deletion.
1524 EXPECT_EQ(0U, model()->GetTemplateURLs().size()); 1524 EXPECT_EQ(0U, model()->GetTemplateURLs().size());
1525 EXPECT_EQ(2U, processor()->change_list_size()); 1525 EXPECT_EQ(2U, processor()->change_list_size());
1526 ASSERT_TRUE(processor()->contains_guid("key1")); 1526 ASSERT_TRUE(processor()->contains_guid("key1"));
1527 EXPECT_EQ(SyncChange::ACTION_DELETE, 1527 EXPECT_EQ(SyncChange::ACTION_DELETE,
1528 processor()->change_for_guid("key1").change_type()); 1528 processor()->change_for_guid("key1").change_type());
1529 ASSERT_TRUE(processor()->contains_guid(std::string())); 1529 ASSERT_TRUE(processor()->contains_guid(std::string()));
1530 EXPECT_EQ(SyncChange::ACTION_DELETE, 1530 EXPECT_EQ(SyncChange::ACTION_DELETE,
1531 processor()->change_for_guid(std::string()).change_type()); 1531 processor()->change_for_guid(std::string()).change_type());
1532 } 1532 }
1533
1534 TEST_F(TemplateURLServiceSyncTest, PreSyncDeletes) {
1535 model()->pre_sync_deletes_.insert("key1");
1536 model()->pre_sync_deletes_.insert("key2");
1537 model()->pre_sync_deletes_.insert("aaa");
1538 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("whatever"),
1539 "http://key1.com", "bbb"));
1540 model()->MergeDataAndStartSyncing(syncable::SEARCH_ENGINES,
1541 CreateInitialSyncData(), PassProcessor(),
1542 CreateAndPassSyncErrorFactory());
1543
1544 // We expect the model to have GUIDs {bbb, key3} after our initial merge.
1545 EXPECT_TRUE(model()->GetTemplateURLForGUID("bbb"));
1546 EXPECT_TRUE(model()->GetTemplateURLForGUID("key3"));
1547 SyncChange change = processor()->change_for_guid("key1");
1548 EXPECT_EQ(SyncChange::ACTION_DELETE, change.change_type());
1549 change = processor()->change_for_guid("key2");
1550 EXPECT_EQ(SyncChange::ACTION_DELETE, change.change_type());
1551 // "aaa" should have been pruned out on account of not being from Sync.
1552 EXPECT_FALSE(processor()->contains_guid("aaa"));
1553 // The set of pre-sync deletes should be cleared so they're not reused if
1554 // MergeDataAndStartSyncing gets called again.
1555 EXPECT_TRUE(model()->pre_sync_deletes_.empty());
1556 }
OLDNEW
« 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