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

Unified Diff: chrome/browser/sync/profile_sync_service_autofill_unittest.cc

Issue 7819002: Migrate AutofillProfile sync to new API. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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/sync/profile_sync_service_autofill_unittest.cc
===================================================================
--- chrome/browser/sync/profile_sync_service_autofill_unittest.cc (revision 99006)
+++ chrome/browser/sync/profile_sync_service_autofill_unittest.cc (working copy)
@@ -24,10 +24,11 @@
#include "chrome/browser/sync/glue/autofill_change_processor.h"
#include "chrome/browser/sync/glue/autofill_data_type_controller.h"
#include "chrome/browser/sync/glue/autofill_model_associator.h"
-#include "chrome/browser/sync/glue/autofill_profile_change_processor.h"
#include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h"
-#include "chrome/browser/sync/glue/autofill_profile_model_associator.h"
+#include "chrome/browser/sync/glue/autofill_profile_syncable_service.h"
#include "chrome/browser/sync/glue/data_type_controller.h"
+#include "chrome/browser/sync/glue/generic_change_processor.h"
+#include "chrome/browser/sync/glue/syncable_service_adapter.h"
#include "chrome/browser/sync/internal_api/read_node.h"
#include "chrome/browser/sync/internal_api/read_transaction.h"
#include "chrome/browser/sync/internal_api/write_node.h"
@@ -56,10 +57,11 @@
using browser_sync::AutofillChangeProcessor;
using browser_sync::AutofillDataTypeController;
using browser_sync::AutofillModelAssociator;
-using browser_sync::AutofillProfileChangeProcessor;
using browser_sync::AutofillProfileDataTypeController;
-using browser_sync::AutofillProfileModelAssociator;
+using browser_sync::AutofillProfileSyncableService;
using browser_sync::DataTypeController;
+using browser_sync::GenericChangeProcessor;
+using browser_sync::SyncableServiceAdapter;
using browser_sync::GROUP_DB;
using browser_sync::kAutofillTag;
using browser_sync::SyncBackendHostForProfileSyncTest;
@@ -178,11 +180,16 @@
EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB));
if (!BrowserThread::CurrentlyOn(BrowserThread::DB))
return ProfileSyncFactory::SyncComponents(NULL, NULL);
- AutofillProfileModelAssociator* model_associator =
- new AutofillProfileModelAssociator(service, wd, pdm);
- AutofillProfileChangeProcessor* change_processor =
- new AutofillProfileChangeProcessor(model_associator, wd, pdm, dtc);
- return ProfileSyncFactory::SyncComponents(model_associator,
+ AutofillProfileSyncableService* sync_service =
+ new AutofillProfileSyncableService(wd, pdm);
+ sync_api::UserShare* user_share = service->GetUserShare();
+ GenericChangeProcessor* change_processor =
+ new GenericChangeProcessor(sync_service, dtc, user_share);
+ SyncableServiceAdapter* sync_service_adapter =
+ new SyncableServiceAdapter(syncable::AUTOFILL_PROFILE,
+ sync_service,
+ change_processor);
+ return ProfileSyncFactory::SyncComponents(sync_service_adapter,
change_processor);
}
@@ -362,7 +369,11 @@
if (!node.InitUniqueByCreation(syncable::AUTOFILL_PROFILE,
autofill_root, tag))
return false;
- AutofillProfileChangeProcessor::WriteAutofillProfile(profile, &node);
+ sync_pb::EntitySpecifics specifics;
+ AutofillProfileSyncableService::WriteAutofillProfile(profile, &specifics);
+ sync_pb::AutofillProfileSpecifics* profile_specifics =
+ specifics.MutableExtension(sync_pb::autofill_profile);
+ node.SetAutofillProfileSpecifics(*profile_specifics);
return true;
}
@@ -394,7 +405,7 @@
} else if (autofill.has_profile()) {
AutofillProfile p;
p.set_guid(autofill.profile().guid());
- AutofillProfileModelAssociator::OverwriteProfileWithServerData(&p,
+ AutofillProfileSyncableService::OverwriteProfileWithServerData(&p,
autofill.profile());
profiles->push_back(p);
}
@@ -420,7 +431,7 @@
child_node.GetAutofillProfileSpecifics());
AutofillProfile p;
p.set_guid(autofill.guid());
- AutofillProfileModelAssociator::OverwriteProfileWithServerData(&p,
+ AutofillProfileSyncableService::OverwriteProfileWithServerData(&p,
autofill);
profiles->push_back(p);
child_id = child_node.GetSuccessorId();

Powered by Google App Engine
This is Rietveld 408576698