diff options
author | bartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-12 16:55:35 +0000 |
---|---|---|
committer | bartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-12 16:55:35 +0000 |
commit | d03d2e1c530c0329de57e31e76390defe6cad676 (patch) | |
tree | dabe4be9eeb91d810ba2e8daea1995c88acee42d /chrome/browser/sync/profile_sync_service_unittest.cc | |
parent | 9ba666117ed56d6ff4b1e058f9027798faa31b22 (diff) | |
download | chromium_src-d03d2e1c530c0329de57e31e76390defe6cad676.zip chromium_src-d03d2e1c530c0329de57e31e76390defe6cad676.tar.gz chromium_src-d03d2e1c530c0329de57e31e76390defe6cad676.tar.bz2 |
Introduce ProfileInvalidationProvider wrapper for InvalidationService
TiclInvalidationService was refactored to no longer depend on Profile.
However, it still is a KeyedService. While this does actually pull in
Profile as a dependency, it implies that TiclInvalidationService should
be considered a per-Profile service, like the other KeyedServices in
Chrome's code base.
This CL introduces ProfileInvalidationProvider, a KeyedService that is a
tiny wrapper around an InvalidationService. Given this wrapper,
InvalidationService (and with it, TiclInvalidationService) no longer have
to be KeyedServices.
BUG=362083
TEST=Updated unit and browser tests
TBR=dcheng (chrome/browser/extensions/api/push_messaging/*)
TBR=davemoore (chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc)
TBR=arv (chrome/browser/ui/webui/invalidations_message_handler.cc)
Review URL: https://codereview.chromium.org/327243003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276715 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/profile_sync_service_unittest.cc')
-rw-r--r-- | chrome/browser/sync/profile_sync_service_unittest.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index 771dc21..ddc9a9e 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -10,7 +10,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/invalidation/fake_invalidation_service.h" -#include "chrome/browser/invalidation/invalidation_service_factory.h" +#include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" @@ -24,6 +24,8 @@ #include "chrome/test/base/testing_pref_service_syncable.h" #include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile_manager.h" +#include "components/invalidation/invalidation_service.h" +#include "components/invalidation/profile_invalidation_provider.h" #include "components/signin/core/browser/signin_manager.h" #include "components/sync_driver/data_type_manager_impl.h" #include "components/sync_driver/pref_names.h" @@ -33,6 +35,10 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +namespace content { +class BrowserContext; +} + namespace browser_sync { namespace { @@ -127,6 +133,13 @@ ACTION_P(ReturnNewMockHostCollectDeleteDirParam, delete_dir_param) { delete_dir_param); } +KeyedService* BuildFakeProfileInvalidationProvider( + content::BrowserContext* context) { + return new invalidation::ProfileInvalidationProvider( + scoped_ptr<invalidation::InvalidationService>( + new invalidation::FakeInvalidationService)); +} + // A test harness that uses a real ProfileSyncService and in most cases a // MockSyncBackendHost. // @@ -151,8 +164,8 @@ class ProfileSyncServiceTest : public ::testing::Test { BuildAutoIssuingFakeProfileOAuth2TokenService)); testing_facotries.push_back( std::make_pair( - invalidation::InvalidationServiceFactory::GetInstance(), - invalidation::FakeInvalidationService::Build)); + invalidation::ProfileInvalidationProviderFactory::GetInstance(), + BuildFakeProfileInvalidationProvider)); profile_ = profile_manager_.CreateTestingProfile( "sync-service-test", scoped_ptr<PrefServiceSyncable>(), |