Commit c893a340 authored by Mario Sanchez Prada's avatar Mario Sanchez Prada Committed by Commit Bot

Move ProfileSyncServiceBundle away from low-level signin related objects

Remove any knowledge of AccountTrackerService, FakeSiginManager[Base],
FakeProfileOAuth2TokenService and FakeGaiaCookieManagerService from
ProfileSyncServiceBundle, and depend solely on IdentityTestEnvironment.

Bug: 886600
Change-Id: I268bc85d70c164efa3b9650565b9de13c98f4b4b
Reviewed-on: https://chromium-review.googlesource.com/c/1337618Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Commit-Queue: Mario Sanchez Prada <mario@igalia.com>
Cr-Commit-Position: refs/heads/master@{#608433}
parent 5017f22c
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "base/values.h" #include "base/values.h"
#include "components/browser_sync/browser_sync_switches.h" #include "components/browser_sync/browser_sync_switches.h"
#include "components/browser_sync/profile_sync_test_util.h" #include "components/browser_sync/profile_sync_test_util.h"
#include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/account_info.h"
#include "components/sync/base/pref_names.h" #include "components/sync/base/pref_names.h"
#include "components/sync/driver/configure_context.h" #include "components/sync/driver/configure_context.h"
#include "components/sync/driver/fake_data_type_controller.h" #include "components/sync/driver/fake_data_type_controller.h"
...@@ -292,10 +292,6 @@ class ProfileSyncServiceTest : public ::testing::Test { ...@@ -292,10 +292,6 @@ class ProfileSyncServiceTest : public ::testing::Test {
return profile_sync_service_bundle_.identity_provider(); return profile_sync_service_bundle_.identity_provider();
} }
AccountTrackerService* account_tracker() {
return profile_sync_service_bundle_.account_tracker();
}
identity::IdentityManager* identity_manager() { identity::IdentityManager* identity_manager() {
return profile_sync_service_bundle_.identity_manager(); return profile_sync_service_bundle_.identity_manager();
} }
...@@ -776,12 +772,10 @@ TEST_F(ProfileSyncServiceTest, RevokeAccessTokenFromTokenService) { ...@@ -776,12 +772,10 @@ TEST_F(ProfileSyncServiceTest, RevokeAccessTokenFromTokenService) {
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
ASSERT_FALSE(service()->GetAccessTokenForTest().empty()); ASSERT_FALSE(service()->GetAccessTokenForTest().empty());
std::string secondary_account_gaiaid = "1234567"; AccountInfo secondary_account_info =
std::string secondary_account_name = "test_user2@gmail.com"; identity_test_env()->MakeAccountAvailable("test_user2@gmail.com");
std::string secondary_account_id = account_tracker()->SeedAccountInfo( identity_test_env()->RemoveRefreshTokenForAccount(
secondary_account_gaiaid, secondary_account_name); secondary_account_info.account_id);
identity_test_env()->SetRefreshTokenForAccount(secondary_account_id);
identity_test_env()->RemoveRefreshTokenForAccount(secondary_account_id);
EXPECT_FALSE(service()->GetAccessTokenForTest().empty()); EXPECT_FALSE(service()->GetAccessTokenForTest().empty());
identity_test_env()->RemoveRefreshTokenForPrimaryAccount(); identity_test_env()->RemoveRefreshTokenForPrimaryAccount();
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "components/history/core/browser/history_service.h" #include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/sync/history_model_worker.h" #include "components/history/core/browser/sync/history_model_worker.h"
#include "components/pref_registry/pref_registry_syncable.h" #include "components/pref_registry/pref_registry_syncable.h"
#include "components/signin/core/browser/signin_manager_base.h"
#include "components/sync/base/sync_prefs.h" #include "components/sync/base/sync_prefs.h"
#include "components/sync/engine/passive_model_worker.h" #include "components/sync/engine/passive_model_worker.h"
#include "components/sync/engine/sequenced_model_worker.h" #include "components/sync/engine/sequenced_model_worker.h"
...@@ -231,26 +230,9 @@ ProfileSyncServiceBundle::SyncClientBuilder::Build() { ...@@ -231,26 +230,9 @@ ProfileSyncServiceBundle::SyncClientBuilder::Build() {
ProfileSyncServiceBundle::ProfileSyncServiceBundle() ProfileSyncServiceBundle::ProfileSyncServiceBundle()
: db_thread_(base::SequencedTaskRunnerHandle::Get()), : db_thread_(base::SequencedTaskRunnerHandle::Get()),
signin_client_(&pref_service_), identity_test_env_(true) {
#if defined(OS_CHROMEOS)
signin_manager_(&signin_client_, &account_tracker_),
#else
signin_manager_(&signin_client_,
&auth_service_,
&account_tracker_,
nullptr),
#endif
auth_service_(&pref_service_),
gaia_cookie_manager_service_(&auth_service_,
&signin_client_),
identity_test_env_(&account_tracker_,
&auth_service_,
&signin_manager_,
&gaia_cookie_manager_service_) {
RegisterPrefsForProfileSyncService(pref_service_.registry()); RegisterPrefsForProfileSyncService(pref_service_.registry());
auth_service_.set_auto_post_fetch_response_on_message_loop(true); identity_test_env_.SetAutomaticIssueOfAccessTokens(true);
account_tracker_.Initialize(&pref_service_, base::FilePath());
signin_manager_.Initialize(&pref_service_);
identity_provider_ = std::make_unique<invalidation::ProfileIdentityProvider>( identity_provider_ = std::make_unique<invalidation::ProfileIdentityProvider>(
identity_manager()); identity_manager());
} }
......
...@@ -13,11 +13,6 @@ ...@@ -13,11 +13,6 @@
#include "components/browser_sync/profile_sync_service.h" #include "components/browser_sync/profile_sync_service.h"
#include "components/invalidation/impl/fake_invalidation_service.h" #include "components/invalidation/impl/fake_invalidation_service.h"
#include "components/invalidation/impl/profile_identity_provider.h" #include "components/invalidation/impl/profile_identity_provider.h"
#include "components/signin/core/browser/account_tracker_service.h"
#include "components/signin/core/browser/fake_gaia_cookie_manager_service.h"
#include "components/signin/core/browser/fake_profile_oauth2_token_service.h"
#include "components/signin/core/browser/fake_signin_manager.h"
#include "components/signin/core/browser/test_signin_client.h"
#include "components/sync/driver/fake_sync_client.h" #include "components/sync/driver/fake_sync_client.h"
#include "components/sync/driver/sync_api_component_factory_mock.h" #include "components/sync/driver/sync_api_component_factory_mock.h"
#include "components/sync/model/test_model_type_store_service.h" #include "components/sync/model/test_model_type_store_service.h"
...@@ -44,12 +39,6 @@ void RegisterPrefsForProfileSyncService( ...@@ -44,12 +39,6 @@ void RegisterPrefsForProfileSyncService(
// MessageLoop, though. // MessageLoop, though.
class ProfileSyncServiceBundle { class ProfileSyncServiceBundle {
public: public:
#if defined(OS_CHROMEOS)
using FakeSigninManagerType = FakeSigninManagerBase;
#else
using FakeSigninManagerType = FakeSigninManager;
#endif
ProfileSyncServiceBundle(); ProfileSyncServiceBundle();
~ProfileSyncServiceBundle(); ~ProfileSyncServiceBundle();
...@@ -127,10 +116,6 @@ class ProfileSyncServiceBundle { ...@@ -127,10 +116,6 @@ class ProfileSyncServiceBundle {
return &pref_service_; return &pref_service_;
} }
FakeProfileOAuth2TokenService* auth_service() { return &auth_service_; }
FakeSigninManagerType* signin_manager() { return &signin_manager_; }
identity::IdentityTestEnvironment* identity_test_env() { identity::IdentityTestEnvironment* identity_test_env() {
return &identity_test_env_; return &identity_test_env_;
} }
...@@ -139,8 +124,6 @@ class ProfileSyncServiceBundle { ...@@ -139,8 +124,6 @@ class ProfileSyncServiceBundle {
return identity_test_env_.identity_manager(); return identity_test_env_.identity_manager();
} }
AccountTrackerService* account_tracker() { return &account_tracker_; }
syncer::SyncApiComponentFactoryMock* component_factory() { syncer::SyncApiComponentFactoryMock* component_factory() {
return &component_factory_; return &component_factory_;
} }
...@@ -164,11 +147,6 @@ class ProfileSyncServiceBundle { ...@@ -164,11 +147,6 @@ class ProfileSyncServiceBundle {
scoped_refptr<base::SequencedTaskRunner> db_thread_; scoped_refptr<base::SequencedTaskRunner> db_thread_;
sync_preferences::TestingPrefServiceSyncable pref_service_; sync_preferences::TestingPrefServiceSyncable pref_service_;
syncer::TestModelTypeStoreService model_type_store_service_; syncer::TestModelTypeStoreService model_type_store_service_;
TestSigninClient signin_client_;
AccountTrackerService account_tracker_;
FakeSigninManagerType signin_manager_;
FakeProfileOAuth2TokenService auth_service_;
FakeGaiaCookieManagerService gaia_cookie_manager_service_;
identity::IdentityTestEnvironment identity_test_env_; identity::IdentityTestEnvironment identity_test_env_;
testing::NiceMock<syncer::SyncApiComponentFactoryMock> component_factory_; testing::NiceMock<syncer::SyncApiComponentFactoryMock> component_factory_;
std::unique_ptr<invalidation::ProfileIdentityProvider> identity_provider_; std::unique_ptr<invalidation::ProfileIdentityProvider> identity_provider_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment