From 72a31b4cffaaf6a60500b31323ba7fba6793a074 Mon Sep 17 00:00:00 2001 From: "skrul@chromium.org" Date: Wed, 17 Feb 2010 22:26:33 +0000 Subject: This change will include preferences as part of the usual startup sequence of the PSS that already includes bookmarks. This is a temporary solution until we have a proper component to manage the startup and shutdown of multiple data types. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=39143 Review URL: http://codereview.chromium.org/601037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39282 0039d316-1c4b-4281-b951-d872f2087c98 --- .../browser/sync/profile_sync_service_unittest.cc | 42 ++-------------------- 1 file changed, 3 insertions(+), 39 deletions(-) (limited to 'chrome/browser/sync/profile_sync_service_unittest.cc') diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index 1753370..f7b97e5 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -21,12 +21,11 @@ #include "chrome/browser/sync/glue/model_associator.h" #include "chrome/browser/sync/glue/sync_backend_host.h" #include "chrome/browser/sync/notification_method.h" -#include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_factory.h" +#include "chrome/browser/sync/test_profile_sync_service.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_profile.h" -#include "chrome/test/sync/test_http_bridge_factory.h" using std::vector; using browser_sync::AssociatorInterface; @@ -35,7 +34,6 @@ using browser_sync::BookmarkModelAssociator; using browser_sync::ChangeProcessor; using browser_sync::ModelAssociator; using browser_sync::SyncBackendHost; -using browser_sync::TestHttpBridgeFactory; class TestProfileSyncFactory : public ProfileSyncFactory { public: @@ -123,40 +121,6 @@ class TestModelAssociator : public BookmarkModelAssociator { ~TestModelAssociator() {} }; -class TestProfileSyncService : public ProfileSyncService { - public: - explicit TestProfileSyncService(Profile* profile) - : ProfileSyncService(profile) { - RegisterPreferences(); - SetSyncSetupCompleted(); - } - virtual ~TestProfileSyncService() { - } - - virtual void InitializeBackend(bool delete_sync_data_folder) { - TestHttpBridgeFactory* factory = new TestHttpBridgeFactory(); - TestHttpBridgeFactory* factory2 = new TestHttpBridgeFactory(); - backend()->InitializeForTestMode(L"testuser", factory, factory2, - delete_sync_data_folder, browser_sync::kDefaultNotificationMethod); - // The SyncBackend posts a task to the current loop when initialization - // completes. - MessageLoop::current()->Run(); - // Initialization is synchronous for test mode, so we should be good to go. - DCHECK(sync_initialized()); - } - - virtual void OnBackendInitialized() { - ProfileSyncService::OnBackendInitialized(); - MessageLoop::current()->Quit(); - } - - // TODO(skrul): how to handle this? - virtual bool MergeAndSyncAcceptanceNeeded() { - // Never show the dialog. - return false; - } -}; - // FakeServerChange constructs a list of sync_api::ChangeRecords while modifying // the sync model, and can pass the ChangeRecord list to a // sync_api::SyncObserver (i.e., the ProfileSyncService) to test the client @@ -335,7 +299,7 @@ class ProfileSyncServiceTest : public testing::Test { void StartSyncService() { if (!service_.get()) { - service_.reset(new TestProfileSyncService(profile_.get())); + service_.reset(new TestProfileSyncService(profile_.get(), false)); // Register the bookmark data type. model_associator_ = new TestModelAssociator(service_.get()); @@ -1389,7 +1353,7 @@ TEST_F(ProfileSyncServiceTestWithData, MAYBE_TestStartupWithOldSyncData) { LoadBookmarkModel(LOAD_FROM_STORAGE, SAVE_TO_STORAGE); if (!service_.get()) { - service_.reset(new TestProfileSyncService(profile_.get())); + service_.reset(new TestProfileSyncService(profile_.get(), false)); profile_->GetPrefs()->SetBoolean(prefs::kSyncHasSetupCompleted, false); model_associator_ = new TestModelAssociator(service_.get()); -- cgit v1.1