Chromium Code Reviews| Index: chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc |
| 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 1609a9f4d188b891c3538a5463957dcd9a983d97..f6846a972bb1c242ffe4b436c352353f7c5e9252 100644 |
| --- a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc |
| +++ b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc |
| @@ -59,10 +59,6 @@ class FakeWebDataService : public WebDataService { |
| return is_database_loaded_; |
| } |
| - virtual void ShutdownOnUIThread() OVERRIDE { |
| - ShutdownSyncableService(); |
| - } |
| - |
| virtual AutocompleteSyncableService* |
| GetAutocompleteSyncableService() const OVERRIDE { |
| return autocomplete_syncable_service_; |
| @@ -129,6 +125,33 @@ class FakeWebDataService : public WebDataService { |
| DISALLOW_COPY_AND_ASSIGN(FakeWebDataService); |
| }; |
| +class MockWebDataServiceWrapper : public WebDataServiceWrapper { |
|
dhollowa
2013/03/18 22:38:38
Please move this class out into a common place. V
dhollowa
2013/03/19 15:30:52
What's happening here?
Jói
2013/03/19 16:32:18
Done.
|
| + public: |
| + static ProfileKeyedService* Build(Profile* profile) { |
| + return new MockWebDataServiceWrapper(); |
| + } |
| + |
| + MockWebDataServiceWrapper() { |
| + fake_web_data_service_ = 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; |
|
dhollowa
2013/03/18 22:38:38
not needed
Cait (Slow)
2013/03/19 05:14:19
Done.
|
| + } |
| + |
| + private: |
| + scoped_refptr<FakeWebDataService> fake_web_data_service_; |
| + |
|
dhollowa
2013/03/18 22:38:38
nit: delete extra line
Cait (Slow)
2013/03/19 05:14:19
Done.
|
| +}; |
|
dhollowa
2013/03/18 22:38:38
DISALLOW_COPY_AND_ASSIGN
Cait (Slow)
2013/03/19 05:14:19
Done.
|
| + |
| class SyncAutofillDataTypeControllerTest : public testing::Test { |
| public: |
| SyncAutofillDataTypeControllerTest() |
| @@ -147,7 +170,7 @@ class SyncAutofillDataTypeControllerTest : public testing::Test { |
| WillRepeatedly(Return(change_processor_.get())); |
| WebDataServiceFactory::GetInstance()->SetTestingFactory( |
| - &profile_, BuildWebDataService); |
| + &profile_, MockWebDataServiceWrapper::Build); |
| autofill_dtc_ = |
| new AutofillDataTypeController(&profile_sync_factory_, |
| @@ -175,11 +198,6 @@ class SyncAutofillDataTypeControllerTest : public testing::Test { |
| change_processor_ = NULL; |
| } |
| - static scoped_refptr<RefcountedProfileKeyedService> |
| - BuildWebDataService(Profile* profile) { |
| - return new FakeWebDataService(); |
| - } |
| - |
| void BlockForDBThread() { |
| base::RunLoop run_loop; |
| ASSERT_TRUE(BrowserThread::PostTaskAndReply(BrowserThread::DB, FROM_HERE, |