| 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 cc0b4f356f8c6c72aeeb0bddee57a88b8b7ef4ad..1ff1769e73130d676d92d77d667e09c5ff64164e 100644
|
| --- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
|
| +++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
|
| @@ -119,7 +119,6 @@ MATCHER_P(MatchProfiles, profile, "") {
|
| return (profile.Compare(arg) == 0);
|
| }
|
|
|
| -
|
| class WebDatabaseFake : public WebDatabase {
|
| public:
|
| explicit WebDatabaseFake(AutofillTable* autofill_table)
|
| @@ -157,10 +156,6 @@ class WebDataServiceFake : public WebDataService {
|
| syncable_service_created_or_destroyed_(false, false) {
|
| }
|
|
|
| - static scoped_refptr<RefcountedProfileKeyedService> Build(Profile* profile) {
|
| - return new WebDataServiceFake;
|
| - }
|
| -
|
| void SetDatabase(WebDatabase* web_database) {
|
| web_database_ = web_database;
|
| }
|
| @@ -249,6 +244,32 @@ class WebDataServiceFake : public WebDataService {
|
| WaitableEvent syncable_service_created_or_destroyed_;
|
| };
|
|
|
| +class MockWebDataServiceWrapper : public WebDataServiceWrapper {
|
| + public:
|
| + static ProfileKeyedService* Build(Profile* profile) {
|
| + return new MockWebDataServiceWrapper();
|
| + }
|
| +
|
| + MockWebDataServiceWrapper() {
|
| + web_data_service_fake_ = new WebDataServiceFake();
|
| + }
|
| +
|
| + void Shutdown() OVERRIDE {
|
| + }
|
| +
|
| + scoped_refptr<WebDataService> GetWebData() OVERRIDE {
|
| + return web_data_service_fake_;
|
| + }
|
| +
|
| + ~MockWebDataServiceWrapper() {
|
| + web_data_service_fake_ = NULL;
|
| + }
|
| +
|
| + private:
|
| + scoped_refptr<WebDataServiceFake> web_data_service_fake_;
|
| +
|
| +};
|
| +
|
| ACTION_P(MakeAutocompleteSyncComponents, wds) {
|
| EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB));
|
| if (!BrowserThread::CurrentlyOn(BrowserThread::DB))
|
| @@ -410,9 +431,12 @@ class ProfileSyncServiceAutofillTest
|
| profile_.reset(new ProfileMock());
|
| profile_->CreateRequestContext();
|
| web_database_.reset(new WebDatabaseFake(&autofill_table_));
|
| - web_data_service_ = static_cast<WebDataServiceFake*>(
|
| - WebDataServiceFactory::GetInstance()->SetTestingFactoryAndUse(
|
| - profile_.get(), WebDataServiceFake::Build).get());
|
| + MockWebDataServiceWrapper* wrapper =
|
| + static_cast<MockWebDataServiceWrapper*>(
|
| + WebDataServiceFactory::GetInstance()->SetTestingFactoryAndUse(
|
| + profile_.get(), MockWebDataServiceWrapper::Build));
|
| + web_data_service_ =
|
| + static_cast<WebDataServiceFake*>(wrapper->GetWebData().get());
|
| web_data_service_->SetDatabase(web_database_.get());
|
|
|
| MockPersonalDataManagerService* personal_data_manager_service =
|
|
|