diff options
author | skrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-16 22:20:26 +0000 |
---|---|---|
committer | skrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-16 22:20:26 +0000 |
commit | 500f176dbbd17fee9f903d0163dafa89593cc1c0 (patch) | |
tree | 4a7550425c7bf70879d4146b959bac0ab0712131 /chrome/browser/sync/test_profile_sync_service.h | |
parent | 4cedf0dadf16c181be11d86f15af28c43c81b705 (diff) | |
download | chromium_src-500f176dbbd17fee9f903d0163dafa89593cc1c0.zip chromium_src-500f176dbbd17fee9f903d0163dafa89593cc1c0.tar.gz chromium_src-500f176dbbd17fee9f903d0163dafa89593cc1c0.tar.bz2 |
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.
Review URL: http://codereview.chromium.org/601037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39143 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/test_profile_sync_service.h')
-rw-r--r-- | chrome/browser/sync/test_profile_sync_service.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/chrome/browser/sync/test_profile_sync_service.h b/chrome/browser/sync/test_profile_sync_service.h new file mode 100644 index 0000000..96d57da --- /dev/null +++ b/chrome/browser/sync/test_profile_sync_service.h @@ -0,0 +1,43 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ +#define CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ + +#include "base/message_loop.h" +#include "chrome/browser/profile.h" +#include "chrome/browser/sync/profile_sync_service.h" +#include "chrome/test/sync/test_http_bridge_factory.h" + +class TestProfileSyncService : public ProfileSyncService { + public: + explicit TestProfileSyncService(Profile* profile) + : ProfileSyncService(profile) { + RegisterPreferences(); + SetSyncSetupCompleted(); + } + virtual ~TestProfileSyncService() { + } + + virtual void InitializeBackend(bool delete_sync_data_folder) { + browser_sync::TestHttpBridgeFactory* factory = + new browser_sync::TestHttpBridgeFactory(); + browser_sync::TestHttpBridgeFactory* factory2 = + new browser_sync::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(); + } +}; + +#endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ |