diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-09 21:59:32 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-09 21:59:32 +0000 |
commit | f37bff408d28bb87f74ebb1907cb4727ae22329e (patch) | |
tree | 38d35c642704dfa79b6e0b2fc1abbc28570a4b33 /chrome/browser/sync | |
parent | 4f61e0e76ac6a0fb034cfd0973d06e5216ada7fc (diff) | |
download | chromium_src-f37bff408d28bb87f74ebb1907cb4727ae22329e.zip chromium_src-f37bff408d28bb87f74ebb1907cb4727ae22329e.tar.gz chromium_src-f37bff408d28bb87f74ebb1907cb4727ae22329e.tar.bz2 |
Attempt 2 at: Splits ChromeURLDataManager into 2 chunks:
. ChromeURLDataManager is no longer a singleton and is always used on
the UI thread. ChromeURLDataManager is now profile specific (you get
from the profile).
. ChromeURLDataManagerBackend handles the URLRequests and the
DataSources. ChromeURLDataManagerBackend is created by
ChromeURLRequestContext.
All DataSources are now profile specific. There were two that wanted
to be global, but have been converted.
This differs from the version I landed in that there is now a NULL
check in ChromeURLDataManager::DeleteDataSources.
BUG=52022 71868
TEST=none
TBR=willchan, evan, ahendrickson
Review URL: http://codereview.chromium.org/6462036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74340 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync')
-rw-r--r-- | chrome/browser/sync/profile_sync_service_mock.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_wizard.cc | 13 | ||||
-rw-r--r-- | chrome/browser/sync/sync_ui_util_unittest.cc | 3 |
3 files changed, 7 insertions, 11 deletions
diff --git a/chrome/browser/sync/profile_sync_service_mock.cc b/chrome/browser/sync/profile_sync_service_mock.cc index f843159..99e9ede 100644 --- a/chrome/browser/sync/profile_sync_service_mock.cc +++ b/chrome/browser/sync/profile_sync_service_mock.cc @@ -9,6 +9,4 @@ ProfileSyncServiceMock::ProfileSyncServiceMock() {} ProfileSyncServiceMock::~ProfileSyncServiceMock() { - ChromeURLDataManager::GetInstance()->RemoveDataSourceForTest( - chrome::kChromeUISyncResourcesHost); } diff --git a/chrome/browser/sync/sync_setup_wizard.cc b/chrome/browser/sync/sync_setup_wizard.cc index 2cb6b7e..632d60d 100644 --- a/chrome/browser/sync/sync_setup_wizard.cc +++ b/chrome/browser/sync/sync_setup_wizard.cc @@ -260,19 +260,14 @@ SyncSetupWizard::SyncSetupWizard(ProfileSyncService* service) : service_(service), flow_container_(new SyncSetupFlowContainer()), parent_window_(NULL) { - // If we're in a unit test, we may not have an IO thread. Avoid + // If we're in a unit test, we may not have an IO thread or profile. Avoid // creating a SyncResourcesSource since we may leak it (since it's // DeleteOnUIThread). - if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { + if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && + service_->profile()) { // Add our network layer data source for 'cloudy' URLs. SyncResourcesSource* sync_source = new SyncResourcesSource(); - bool posted = - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - NewRunnableMethod(ChromeURLDataManager::GetInstance(), - &ChromeURLDataManager::AddDataSource, - make_scoped_refptr(sync_source))); - DCHECK(posted); + service_->profile()->GetChromeURLDataManager()->AddDataSource(sync_source); } } diff --git a/chrome/browser/sync/sync_ui_util_unittest.cc b/chrome/browser/sync/sync_ui_util_unittest.cc index 7122170..96dd2c909 100644 --- a/chrome/browser/sync/sync_ui_util_unittest.cc +++ b/chrome/browser/sync/sync_ui_util_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/basictypes.h" +#include "chrome/browser/browser_thread.h" #include "chrome/browser/sync/sync_ui_util.h" #include "chrome/browser/sync/profile_sync_service_mock.h" #include "testing/gmock/include/gmock/gmock.h" @@ -12,6 +13,8 @@ using ::testing::Return; using ::testing::NiceMock; TEST(SyncUIUtilTest, ConstructAboutInformationWithUnrecoverableErrorTest) { + MessageLoopForUI message_loop; + BrowserThread ui_thread(BrowserThread::UI, &message_loop); NiceMock<ProfileSyncServiceMock> service; DictionaryValue strings; |