diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-20 11:59:36 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-20 11:59:36 +0000 |
commit | 67fcbafb309eece99f37c65851cc9fa7f6fbfcc3 (patch) | |
tree | f9d4418a57f59541285e157d9a4b95e1d25d5a76 /chrome/browser/sync/glue | |
parent | 4f114efe23ac1deca0cb2ce511f7c62ac5263345 (diff) | |
download | chromium_src-67fcbafb309eece99f37c65851cc9fa7f6fbfcc3.zip chromium_src-67fcbafb309eece99f37c65851cc9fa7f6fbfcc3.tar.gz chromium_src-67fcbafb309eece99f37c65851cc9fa7f6fbfcc3.tar.bz2 |
Create a common base class for all the webdatas
Depends on: https://codereview.chromium.org/12871006/ and
https://codereview.chromium.org/12491017/
Unfortunately, until we fix ownership issues, this base has to be ref-counted, which means that AutofillWebDataService has to be refcounted too in order to inherit from it. Blah.
TBR=ben@chromium.org
COLLABORATOR=joi@chromium.org
TEST=unit_tests
BUG=181277
Patch originally by caitkp@chromium.org
Review URL: https://codereview.chromium.org/12851008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189245 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/glue')
-rw-r--r-- | chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc index f6846a9..b6cac6a 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc @@ -17,6 +17,7 @@ #include "chrome/browser/webdata/autocomplete_syncable_service.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/browser/webdata/web_data_service_factory.h" +#include "chrome/browser/webdata/web_data_service_test_util.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/profile_mock.h" #include "content/public/browser/notification_service.h" @@ -125,31 +126,23 @@ class FakeWebDataService : public WebDataService { DISALLOW_COPY_AND_ASSIGN(FakeWebDataService); }; -class MockWebDataServiceWrapper : public WebDataServiceWrapper { +class MockWebDataServiceWrapperSyncable : public MockWebDataServiceWrapper { public: static ProfileKeyedService* Build(Profile* profile) { - return new MockWebDataServiceWrapper(); + return new MockWebDataServiceWrapperSyncable(); } - MockWebDataServiceWrapper() { - fake_web_data_service_ = new FakeWebDataService(); + MockWebDataServiceWrapperSyncable() + : MockWebDataServiceWrapper(new FakeWebDataService()) { } void Shutdown() OVERRIDE { - fake_web_data_service_->ShutdownSyncableService(); - } - - scoped_refptr<WebDataService> GetWebData() OVERRIDE { - return fake_web_data_service_; - } - - ~MockWebDataServiceWrapper() { - fake_web_data_service_ = NULL; + static_cast<FakeWebDataService*>( + fake_web_data_service_.get())->ShutdownSyncableService(); } private: - scoped_refptr<FakeWebDataService> fake_web_data_service_; - + DISALLOW_COPY_AND_ASSIGN(MockWebDataServiceWrapperSyncable); }; class SyncAutofillDataTypeControllerTest : public testing::Test { @@ -170,7 +163,7 @@ class SyncAutofillDataTypeControllerTest : public testing::Test { WillRepeatedly(Return(change_processor_.get())); WebDataServiceFactory::GetInstance()->SetTestingFactory( - &profile_, MockWebDataServiceWrapper::Build); + &profile_, MockWebDataServiceWrapperSyncable::Build); autofill_dtc_ = new AutofillDataTypeController(&profile_sync_factory_, |