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

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

Issue 151963002: Remove duplicated code from sync related unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename SyncChangeProcessorDelgate to SyncChangeProcessorDelgator. Created 6 years, 11 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 79501af4c1f10be67566467faba9bd0c89261984..f5696e15d8d662d5c172c7c61387cfb9d4caf0c8 100644
--- a/chrome/browser/search_engines/template_url_service_sync_unittest.cc
+++ b/chrome/browser/search_engines/template_url_service_sync_unittest.cc
@@ -22,6 +22,7 @@
#include "content/public/browser/notification_service.h"
#include "extensions/common/constants.h"
#include "net/base/net_util.h"
+#include "sync/api/sync_change_processor_delegator.h"
#include "sync/api/sync_error_factory.h"
#include "sync/api/sync_error_factory_mock.h"
#include "sync/protocol/search_engine_specifics.pb.h"
@@ -145,45 +146,6 @@ syncer::SyncError TestChangeProcessor::ProcessSyncChanges(
}
-// SyncChangeProcessorDelegate ------------------------------------------------
-
-class SyncChangeProcessorDelegate : public syncer::SyncChangeProcessor {
- public:
- explicit SyncChangeProcessorDelegate(syncer::SyncChangeProcessor* recipient);
- virtual ~SyncChangeProcessorDelegate();
-
- // syncer::SyncChangeProcessor implementation.
- virtual syncer::SyncError ProcessSyncChanges(
- const tracked_objects::Location& from_here,
- const syncer::SyncChangeList& change_list) OVERRIDE;
-
- virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const
- OVERRIDE {
- return recipient_->GetAllSyncData(type);
- }
-
- private:
- // The recipient of all sync changes.
- syncer::SyncChangeProcessor* recipient_;
-
- DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate);
-};
-
-SyncChangeProcessorDelegate::SyncChangeProcessorDelegate(
- syncer::SyncChangeProcessor* recipient)
- : recipient_(recipient) {
- DCHECK(recipient_);
-}
-
-SyncChangeProcessorDelegate::~SyncChangeProcessorDelegate() {
-}
-
-syncer::SyncError SyncChangeProcessorDelegate::ProcessSyncChanges(
- const tracked_objects::Location& from_here,
- const syncer::SyncChangeList& change_list) {
- return recipient_->ProcessSyncChanges(from_here, change_list);
-}
-
} // namespace
@@ -257,16 +219,15 @@ class TemplateURLServiceSyncTest : public testing::Test {
// Our dummy ChangeProcessor used to inspect changes pushed to Sync.
scoped_ptr<TestChangeProcessor> sync_processor_;
- scoped_ptr<SyncChangeProcessorDelegate> sync_processor_delegate_;
+ scoped_ptr<syncer::SyncChangeProcessorDelegator> sync_processor_delegate_;
DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceSyncTest);
};
TemplateURLServiceSyncTest::TemplateURLServiceSyncTest()
: sync_processor_(new TestChangeProcessor),
- sync_processor_delegate_(new SyncChangeProcessorDelegate(
- sync_processor_.get())) {
-}
+ sync_processor_delegate_(
+ new syncer::SyncChangeProcessorDelegator(sync_processor_.get())) {}
void TemplateURLServiceSyncTest::SetUp() {
test_util_a_.SetUp();
@@ -1321,8 +1282,8 @@ TEST_F(TemplateURLServiceSyncTest, MergeTwoClientsBasic) {
// Merge A and B. All of B's data should transfer over to A, which initially
// has no data.
- scoped_ptr<SyncChangeProcessorDelegate> delegate_b(
- new SyncChangeProcessorDelegate(model_b()));
+ scoped_ptr<syncer::SyncChangeProcessorDelegator> delegate_b(
+ new syncer::SyncChangeProcessorDelegator(model_b()));
maniscalco 2014/02/03 23:05:50 Unfortunately, model_b() returns a TemplateURLServ
maniscalco 2014/02/06 20:05:27 Done.
model_a()->MergeDataAndStartSyncing(syncer::SEARCH_ENGINES,
model_b()->GetAllSyncData(syncer::SEARCH_ENGINES),
delegate_b.PassAs<syncer::SyncChangeProcessor>(),
@@ -1350,8 +1311,8 @@ TEST_F(TemplateURLServiceSyncTest, MergeTwoClientsDupesAndConflicts) {
"key6", 10)); // Conflict with key1
// Merge A and B.
- scoped_ptr<SyncChangeProcessorDelegate> delegate_b(
- new SyncChangeProcessorDelegate(model_b()));
+ scoped_ptr<syncer::SyncChangeProcessorDelegator> delegate_b(
+ new syncer::SyncChangeProcessorDelegator(model_b()));
model_a()->MergeDataAndStartSyncing(syncer::SEARCH_ENGINES,
model_b()->GetAllSyncData(syncer::SEARCH_ENGINES),
delegate_b.PassAs<syncer::SyncChangeProcessor>(),
@@ -1468,8 +1429,8 @@ TEST_F(TemplateURLServiceSyncTest, MergeTwiceWithSameSyncData) {
// Remerge the data again. This simulates shutting down and syncing again
// at a different time, but the cloud data has not changed.
model()->StopSyncing(syncer::SEARCH_ENGINES);
- sync_processor_delegate_.reset(new SyncChangeProcessorDelegate(
- sync_processor_.get()));
+ sync_processor_delegate_.reset(
+ new syncer::SyncChangeProcessorDelegator(sync_processor_.get()));
error = model()->MergeDataAndStartSyncing(
syncer::SEARCH_ENGINES,
initial_data,

Powered by Google App Engine
This is Rietveld 408576698