diff options
author | skrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-17 22:26:33 +0000 |
---|---|---|
committer | skrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-17 22:26:33 +0000 |
commit | 72a31b4cffaaf6a60500b31323ba7fba6793a074 (patch) | |
tree | 7dd7373eda131c1150294098453624a7077f3209 /chrome/browser/sync/test_profile_sync_service.h | |
parent | c4820a1ae76fed51e67e5db456c99701f2f16e18 (diff) | |
download | chromium_src-72a31b4cffaaf6a60500b31323ba7fba6793a074.zip chromium_src-72a31b4cffaaf6a60500b31323ba7fba6793a074.tar.gz chromium_src-72a31b4cffaaf6a60500b31323ba7fba6793a074.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.
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
Diffstat (limited to 'chrome/browser/sync/test_profile_sync_service.h')
-rw-r--r-- | chrome/browser/sync/test_profile_sync_service.h | 53 |
1 files changed, 53 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..cb86c49 --- /dev/null +++ b/chrome/browser/sync/test_profile_sync_service.h @@ -0,0 +1,53 @@ +// 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 <string> + +#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, + bool bootstrap_sync_authentication) + : ProfileSyncService(profile, bootstrap_sync_authentication) { + 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(); + } + + private: + // When testing under ChromiumOS, this method must not return an empty + // value value in order for the profile sync service to start. + virtual std::string GetLsidForAuthBootstraping() { + return "foo"; + } +}; + +#endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ |