Index: chrome/browser/sync/profile_sync_service_autofill_unittest.cc |
diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc |
index b099148cf6f8eeb52f056dd3c80d8c117cac4e71..0b97327ac7aa226095badc210519d6187f012e19 100644 |
--- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc |
+++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc |
@@ -29,6 +29,7 @@ |
#include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" |
#include "chrome/browser/sync/glue/data_type_controller.h" |
#include "chrome/browser/sync/glue/generic_change_processor.h" |
+#include "chrome/browser/sync/glue/shared_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" |
@@ -63,6 +64,7 @@ using browser_sync::AutofillProfileDataTypeController; |
using browser_sync::AutofillProfileSyncableService; |
using browser_sync::DataTypeController; |
using browser_sync::GenericChangeProcessor; |
+using browser_sync::SharedChangeProcessor; |
using browser_sync::SyncableServiceAdapter; |
using browser_sync::GROUP_DB; |
using browser_sync::kAutofillTag; |
@@ -179,26 +181,25 @@ ACTION_P3(MakeAutofillSyncComponents, service, wd, dtc) { |
change_processor); |
} |
-ACTION_P3(MakeAutofillProfileSyncComponents, service, wds, dtc) { |
+ACTION(MakeGenericChangeProcessor) { |
+ sync_api::UserShare* user_share = arg0->GetUserShare(); |
+ return new GenericChangeProcessor(arg1, arg2, user_share); |
+} |
+ |
+ACTION(MakeSharedChangeProcessor) { |
+ return new SharedChangeProcessor(); |
+} |
+ |
+ACTION_P(MakeAutofillProfileSyncComponents, wds) { |
EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
if (!BrowserThread::CurrentlyOn(BrowserThread::DB)) |
- return ProfileSyncFactory::SyncComponents(NULL, NULL); |
- AutofillProfileSyncableService* sync_service = |
- new AutofillProfileSyncableService(wds); |
- 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); |
+ return base::WeakPtr<SyncableService>(); |
+ return (new AutofillProfileSyncableService(wds))->AsWeakPtr(); |
akalin
2011/10/12 19:54:21
leak? :/ probably need rebase
Nicolas Zea
2011/10/12 23:47:43
Done.
|
} |
class AbstractAutofillFactory { |
public: |
- virtual AutofillDataTypeController* CreateDataTypeController( |
+ virtual DataTypeController* CreateDataTypeController( |
ProfileSyncFactory* factory, |
ProfileMock* profile, |
ProfileSyncService* service) = 0; |
@@ -211,12 +212,11 @@ class AbstractAutofillFactory { |
class AutofillEntryFactory : public AbstractAutofillFactory { |
public: |
- browser_sync::AutofillDataTypeController* CreateDataTypeController( |
+ browser_sync::DataTypeController* CreateDataTypeController( |
ProfileSyncFactory* factory, |
ProfileMock* profile, |
ProfileSyncService* service) { |
- return new AutofillDataTypeController(factory, |
- profile); |
+ return new AutofillDataTypeController(factory, profile); |
} |
void SetExpectation(ProfileSyncFactoryMock* factory, |
@@ -230,20 +230,23 @@ class AutofillEntryFactory : public AbstractAutofillFactory { |
class AutofillProfileFactory : public AbstractAutofillFactory { |
public: |
- browser_sync::AutofillDataTypeController* CreateDataTypeController( |
+ browser_sync::DataTypeController* CreateDataTypeController( |
ProfileSyncFactory* factory, |
ProfileMock* profile, |
ProfileSyncService* service) { |
- return new AutofillProfileDataTypeController(factory, |
- profile); |
+ return new AutofillProfileDataTypeController(factory, profile); |
} |
void SetExpectation(ProfileSyncFactoryMock* factory, |
ProfileSyncService* service, |
WebDataService* wds, |
DataTypeController* dtc) { |
- EXPECT_CALL(*factory, CreateAutofillProfileSyncComponents(_,_,_)). |
- WillOnce(MakeAutofillProfileSyncComponents(service, wds, dtc)); |
+ EXPECT_CALL(*factory, CreateGenericChangeProcessor(_,_,_)). |
+ WillOnce(MakeGenericChangeProcessor()); |
+ EXPECT_CALL(*factory, CreateSharedChangeProcessor()). |
+ WillOnce(MakeSharedChangeProcessor()); |
+ EXPECT_CALL(*factory, GetAutofillProfileSyncableService(_)). |
+ WillOnce(MakeAutofillProfileSyncComponents(wds)); |
} |
}; |
@@ -316,7 +319,7 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest { |
task)); |
EXPECT_CALL(profile_, GetProfileSyncService()).WillRepeatedly( |
Return(service_.get())); |
- AutofillDataTypeController* data_type_controller = |
+ DataTypeController* data_type_controller = |
factory->CreateDataTypeController(&factory_, |
&profile_, |
service_.get()); |