diff options
author | skrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-25 00:42:55 +0000 |
---|---|---|
committer | skrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-25 00:42:55 +0000 |
commit | 5342662c41d6a3e06eb91a3e6e9c3fbd28728886 (patch) | |
tree | 274416b556c1f88b286a17609a89569583905dac /chrome/test | |
parent | fe8fa4c54238b86c22940e7fd672b4b44846083c (diff) | |
download | chromium_src-5342662c41d6a3e06eb91a3e6e9c3fbd28728886.zip chromium_src-5342662c41d6a3e06eb91a3e6e9c3fbd28728886.tar.gz chromium_src-5342662c41d6a3e06eb91a3e6e9c3fbd28728886.tar.bz2 |
Move data type start/stop management into DataTypeManager
This change introduces a new interface/class called DataTypeManager whose job is to choreograph the start up and shut down of all registered data types. It starts each data type serially, waiting for each data type to finish starting before starting the next one. If anything goes wrong on startup, all data types are stopped.
Note that this change also simplifies the ProfileSyncServiceStartupTest as many of the cases it tested for are now the responsibility of the DataTypeManagerImpl (and these are thoroughly tested in its unit test).
I also killed off the TestProfileSyncFactory in the ProfileSyncServiceTest since it was lame and could be done with the mock.
BUG=36506
Review URL: http://codereview.chromium.org/650175
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39964 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/testing_profile.cc | 8 | ||||
-rw-r--r-- | chrome/test/testing_profile.h | 5 |
2 files changed, 12 insertions, 1 deletions
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc index 5770bb9..27708f2 100644 --- a/chrome/test/testing_profile.cc +++ b/chrome/test/testing_profile.cc @@ -5,12 +5,14 @@ #include "chrome/test/testing_profile.h" #include "build/build_config.h" +#include "base/command_line.h" #include "base/string_util.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/dom_ui/ntp_resource_cache.h" #include "chrome/browser/history/history_backend.h" #include "chrome/browser/net/url_request_context_getter.h" #include "chrome/browser/sessions/session_service.h" +#include "chrome/browser/sync/profile_sync_factory_impl.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/notification_service.h" @@ -296,7 +298,11 @@ void TestingProfile::BlockUntilHistoryProcessesPendingRequests() { void TestingProfile::CreateProfileSyncService() { if (!profile_sync_service_.get()) { - profile_sync_service_.reset(new ProfileSyncService(this, false)); + profile_sync_factory_.reset( + new ProfileSyncFactoryImpl(this, + CommandLine::ForCurrentProcess())); + profile_sync_service_.reset( + profile_sync_factory_->CreateProfileSyncService()); profile_sync_service_->Initialize(); } } diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h index 1cc458b..31711fe 100644 --- a/chrome/test/testing_profile.h +++ b/chrome/test/testing_profile.h @@ -21,6 +21,8 @@ #include "chrome/browser/search_engines/template_url_model.h" #include "net/base/cookie_monster.h" +class ProfileSyncFactory; +class ProfileSyncService; class SessionService; class TestingProfile : public Profile { @@ -268,6 +270,9 @@ class TestingProfile : public Profile { // The BookmarkModel. Only created if CreateBookmarkModel is invoked. scoped_ptr<BookmarkModel> bookmark_bar_model_; + // The ProfileSyncFactory. Created by CreateProfileSyncService. + scoped_ptr<ProfileSyncFactory> profile_sync_factory_; + // The ProfileSyncService. Created by CreateProfileSyncService. scoped_ptr<ProfileSyncService> profile_sync_service_; |