Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc

Issue 12491017: Make WebDataService no longer depend on ProfileKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean-up Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..6383c31001a363a082a1560e5b3b8d05a8d3fe83 100644
--- a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc
+++ b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc
@@ -129,6 +129,33 @@ class FakeWebDataService : public WebDataService {
DISALLOW_COPY_AND_ASSIGN(FakeWebDataService);
};
+class MockWebDataServiceWrapper : public WebDataServiceWrapper {
+ public:
+ static ProfileKeyedService* Build(Profile* profile) {
+ return new MockWebDataServiceWrapper();
+ }
+
+ MockWebDataServiceWrapper() {
+ fake_web_data_service_ = new FakeWebDataService();
+ }
+
+ void Shutdown() OVERRIDE {
+ fake_web_data_service_->ShutdownOnUIThread();
+ }
+
+ scoped_refptr<WebDataService> GetWebData() OVERRIDE {
+ return fake_web_data_service_;
+ }
+
+ ~MockWebDataServiceWrapper() {
+ fake_web_data_service_ = NULL;
+ }
+
+ private:
+ scoped_refptr<FakeWebDataService> fake_web_data_service_;
+
+};
+
class SyncAutofillDataTypeControllerTest : public testing::Test {
public:
SyncAutofillDataTypeControllerTest()
@@ -147,7 +174,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 +202,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,

Powered by Google App Engine
This is Rietveld 408576698