| 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 f82ba9608cb31dd2e43cb3b9747f0845012265f5..0a743ff827c9fca96490215332de1ca70d7f44aa 100644
|
| --- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
|
| +++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
|
| @@ -40,7 +40,7 @@
|
| #include "chrome/browser/webdata/autofill_entry.h"
|
| #include "chrome/browser/webdata/autofill_profile_syncable_service.h"
|
| #include "chrome/browser/webdata/autofill_table.h"
|
| -#include "chrome/browser/webdata/web_data_service.h"
|
| +#include "chrome/browser/webdata/autofill_web_data_service_impl.h"
|
| #include "chrome/browser/webdata/web_data_service_factory.h"
|
| #include "chrome/browser/webdata/web_data_service_test_util.h"
|
| #include "chrome/browser/webdata/web_database.h"
|
| @@ -144,10 +144,31 @@ syncer::ModelType GetModelType<AutofillProfile>() {
|
| return syncer::AUTOFILL_PROFILE;
|
| }
|
|
|
| -class WebDataServiceFake : public WebDataService {
|
| +class TokenWebDataServiceFake : public WebDataService {
|
| + public:
|
| + TokenWebDataServiceFake()
|
| + : WebDataService() {
|
| + }
|
| +
|
| + virtual WebDataService::Handle GetAllTokens(
|
| + WebDataServiceConsumer* consumer) OVERRIDE {
|
| + // TODO(tim): It would be nice if WebDataService was injected on
|
| + // construction of TokenService rather than fetched by Initialize so that
|
| + // this isn't necessary (we could pass a NULL service). We currently do
|
| + // return it via EXPECT_CALLs, but without depending on order-of-
|
| + // initialization (which seems way more fragile) we can't tell which
|
| + // component is asking at what time, and some components in these Autofill
|
| + // tests require a WebDataService.
|
| + return 0;
|
| + }
|
| +};
|
| +
|
| +class WebDataServiceFake : public AutofillWebDataServiceImpl {
|
| public:
|
| WebDataServiceFake()
|
| - : web_database_(NULL),
|
| + : AutofillWebDataServiceImpl(
|
| + NULL, WebDataServiceBase::ProfileErrorCallback()),
|
| + web_database_(NULL),
|
| syncable_service_created_or_destroyed_(false, false) {
|
| }
|
|
|
| @@ -181,18 +202,6 @@ class WebDataServiceFake : public WebDataService {
|
| return web_database_;
|
| }
|
|
|
| - virtual WebDataService::Handle GetAllTokens(
|
| - WebDataServiceConsumer* consumer) OVERRIDE {
|
| - // TODO(tim): It would be nice if WebDataService was injected on
|
| - // construction of TokenService rather than fetched by Initialize so that
|
| - // this isn't necessary (we could pass a NULL service). We currently do
|
| - // return it via EXPECT_CALLs, but without depending on order-of-
|
| - // initialization (which seems way more fragile) we can't tell which
|
| - // component is asking at what time, and some components in these Autofill
|
| - // tests require a WebDataService.
|
| - return 0;
|
| - }
|
| -
|
| virtual void ShutdownOnUIThread() OVERRIDE {}
|
|
|
| private:
|
| @@ -218,7 +227,9 @@ class WebDataServiceFake : public WebDataService {
|
| };
|
|
|
| ProfileKeyedService* BuildMockWebDataServiceWrapper(Profile* profile) {
|
| - return new MockWebDataServiceWrapper(new WebDataServiceFake());
|
| + return new MockWebDataServiceWrapper(
|
| + new TokenWebDataServiceFake(),
|
| + new WebDataServiceFake());
|
| }
|
|
|
| ACTION_P(MakeAutocompleteSyncComponents, wds) {
|
| @@ -265,7 +276,7 @@ class AbstractAutofillFactory {
|
| ProfileSyncService* service) = 0;
|
| virtual void SetExpectation(ProfileSyncComponentsFactoryMock* factory,
|
| ProfileSyncService* service,
|
| - WebDataService* wds,
|
| + AutofillWebDataService* wds,
|
| DataTypeController* dtc) = 0;
|
| virtual ~AbstractAutofillFactory() {}
|
| };
|
| @@ -281,7 +292,7 @@ class AutofillEntryFactory : public AbstractAutofillFactory {
|
|
|
| virtual void SetExpectation(ProfileSyncComponentsFactoryMock* factory,
|
| ProfileSyncService* service,
|
| - WebDataService* wds,
|
| + AutofillWebDataService* wds,
|
| DataTypeController* dtc) OVERRIDE {
|
| EXPECT_CALL(*factory, CreateGenericChangeProcessor(_,_,_,_)).
|
| WillOnce(MakeGenericChangeProcessor());
|
| @@ -303,7 +314,7 @@ class AutofillProfileFactory : public AbstractAutofillFactory {
|
|
|
| virtual void SetExpectation(ProfileSyncComponentsFactoryMock* factory,
|
| ProfileSyncService* service,
|
| - WebDataService* wds,
|
| + AutofillWebDataService* wds,
|
| DataTypeController* dtc) OVERRIDE {
|
| EXPECT_CALL(*factory, CreateGenericChangeProcessor(_,_,_,_)).
|
| WillOnce(MakeGenericChangeProcessor());
|
| @@ -387,7 +398,7 @@ class ProfileSyncServiceAutofillTest
|
| WebDataServiceFactory::GetInstance()->SetTestingFactoryAndUse(
|
| profile_.get(), BuildMockWebDataServiceWrapper));
|
| web_data_service_ =
|
| - static_cast<WebDataServiceFake*>(wrapper->GetWebData().get());
|
| + static_cast<WebDataServiceFake*>(wrapper->GetAutofillWebData().get());
|
| web_data_service_->SetDatabase(web_database_.get());
|
|
|
| MockPersonalDataManagerService* personal_data_manager_service =
|
| @@ -466,7 +477,6 @@ class ProfileSyncServiceAutofillTest
|
| sync_service_->RegisterDataTypeController(data_type_controller);
|
| sync_service_->Initialize();
|
| MessageLoop::current()->Run();
|
| -
|
| // It's possible this test triggered an unrecoverable error, in which case
|
| // we can't get the sync count.
|
| if (sync_service_->ShouldPushChanges()) {
|
| @@ -1110,7 +1120,8 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddEntry) {
|
| scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(
|
| db_thread_.DeprecatedGetThreadObject()));
|
| notifier->Notify(chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED,
|
| - content::Source<WebDataService>(web_data_service_.get()),
|
| + content::Source<AutofillWebDataService>(
|
| + web_data_service_.get()),
|
| content::Details<AutofillChangeList>(&changes));
|
|
|
| std::vector<AutofillEntry> new_sync_entries;
|
| @@ -1140,7 +1151,8 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddProfile) {
|
| scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(
|
| db_thread_.DeprecatedGetThreadObject()));
|
| notifier->Notify(chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED,
|
| - content::Source<WebDataService>(web_data_service_.get()),
|
| + content::Source<AutofillWebDataService>(
|
| + web_data_service_.get()),
|
| content::Details<AutofillProfileChange>(&change));
|
|
|
| std::vector<AutofillProfile> new_sync_profiles;
|
| @@ -1174,7 +1186,8 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateEntry) {
|
| scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(
|
| db_thread_.DeprecatedGetThreadObject()));
|
| notifier->Notify(chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED,
|
| - content::Source<WebDataService>(web_data_service_.get()),
|
| + content::Source<AutofillWebDataService>(
|
| + web_data_service_.get()),
|
| content::Details<AutofillChangeList>(&changes));
|
|
|
| std::vector<AutofillEntry> new_sync_entries;
|
| @@ -1204,7 +1217,8 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveEntry) {
|
| scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(
|
| db_thread_.DeprecatedGetThreadObject()));
|
| notifier->Notify(chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED,
|
| - content::Source<WebDataService>(web_data_service_.get()),
|
| + content::Source<AutofillWebDataService>(
|
| + web_data_service_.get()),
|
| content::Details<AutofillChangeList>(&changes));
|
|
|
| std::vector<AutofillEntry> new_sync_entries;
|
| @@ -1243,7 +1257,8 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveProfile) {
|
| scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(
|
| db_thread_.DeprecatedGetThreadObject()));
|
| notifier->Notify(chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED,
|
| - content::Source<WebDataService>(web_data_service_.get()),
|
| + content::Source<AutofillWebDataService>(
|
| + web_data_service_.get()),
|
| content::Details<AutofillProfileChange>(&change));
|
|
|
| std::vector<AutofillProfile> new_sync_profiles;
|
|
|