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

Unified Diff: chrome/browser/sync/profile_sync_service_autofill_unittest.cc

Issue 9834056: Moved WebDataService to ProfileKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: upload rebase Created 8 years, 8 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/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 f6802149bd9cf76e608c76f31d11c51c98d356b8..50ab4eb3b7be70ba5fb136087210114582e9de86 100644
--- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
@@ -46,6 +46,8 @@
#include "chrome/browser/webdata/autofill_profile_syncable_service.h"
#include "chrome/browser/webdata/autofill_table.h"
#include "chrome/browser/webdata/web_database.h"
+#include "chrome/browser/webdata/web_data_service.h"
+#include "chrome/browser/webdata/web_data_service_factory.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/net/gaia/gaia_constants.h"
#include "content/public/browser/notification_source.h"
@@ -159,11 +161,19 @@ syncable::ModelType GetModelType<AutofillProfile>() {
class WebDataServiceFake : public WebDataService {
public:
- explicit WebDataServiceFake(WebDatabase* web_database)
- : web_database_(web_database),
+ WebDataServiceFake()
+ : web_database_(NULL),
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;
+ }
+
void StartSyncableService() {
// The |autofill_profile_syncable_service_| must be constructed on the DB
// thread.
@@ -218,6 +228,8 @@ class WebDataServiceFake : public WebDataService {
return autofill_profile_syncable_service_;
}
+ virtual void ShutdownOnUIThread() OVERRIDE {}
+
private:
void CreateSyncableService() {
ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB));
@@ -342,6 +354,8 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
protected:
ProfileSyncServiceAutofillTest() {
}
+ virtual ~ProfileSyncServiceAutofillTest() {
+ }
AutofillProfileFactory profile_factory_;
AutofillEntryFactory entry_factory_;
@@ -361,7 +375,10 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
AbstractProfileSyncServiceTest::SetUp();
profile_.CreateRequestContext();
web_database_.reset(new WebDatabaseFake(&autofill_table_));
- web_data_service_ = new WebDataServiceFake(web_database_.get());
+ web_data_service_ = static_cast<WebDataServiceFake*>(
+ WebDataServiceFactory::GetInstance()->SetTestingFactoryAndUse(
+ &profile_, WebDataServiceFake::Build).get());
+ web_data_service_->SetDatabase(web_database_.get());
personal_data_manager_ = static_cast<PersonalDataManagerMock*>(
PersonalDataManagerFactory::GetInstance()->SetTestingFactoryAndUse(
&profile_, PersonalDataManagerMock::Build));
@@ -374,12 +391,7 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
WillRepeatedly(Return(static_cast<HistoryService*>(NULL)));
EXPECT_CALL(*personal_data_manager_, LoadProfiles()).Times(1);
EXPECT_CALL(*personal_data_manager_, LoadCreditCards()).Times(1);
- EXPECT_CALL(profile_, GetWebDataService(_)).
- // TokenService::Initialize
- // AutofillDataTypeController::StartModels()
- // In some tests:
- // AutofillProfileSyncableService::AutofillProfileSyncableService()
- WillRepeatedly(Return(web_data_service_.get()));
+
personal_data_manager_->Init(&profile_);
// Note: This must be called *after* the notification service is created.
« no previous file with comments | « chrome/browser/sync/profile_sync_components_factory_impl.cc ('k') | chrome/browser/sync/profile_sync_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698