Commit 9ab642dc authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Migrate ProfileSyncService unit tests to SyncUserSettings

SyncUserSettings is a new class that encapsulates all the
user-configurable knobs for Sync. It replaces a bunch of setters
and getters directly on the SyncService.

Bug: 884159
Change-Id: I31374ece7bf1d6c8b72f8c894e1d9b9a5660d18f
Reviewed-on: https://chromium-review.googlesource.com/c/1337495Reviewed-by: default avatarMohamed Amir Yosef <mamir@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608353}
parent 923926a4
...@@ -261,7 +261,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest, ...@@ -261,7 +261,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest,
EXPECT_CALL(*data_type_manager, Configure(_, _)); EXPECT_CALL(*data_type_manager, Configure(_, _));
ON_CALL(*data_type_manager, state()) ON_CALL(*data_type_manager, state())
.WillByDefault(Return(DataTypeManager::CONFIGURED)); .WillByDefault(Return(DataTypeManager::CONFIGURED));
sync_service()->SetFirstSetupComplete(); sync_service()->GetUserSettings()->SetFirstSetupComplete();
// This should have fully enabled sync. // This should have fully enabled sync.
EXPECT_FALSE(sync_service()->IsSyncConfirmationNeeded()); EXPECT_FALSE(sync_service()->IsSyncConfirmationNeeded());
...@@ -351,7 +351,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportStartupTest, StartFirstTime) { ...@@ -351,7 +351,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportStartupTest, StartFirstTime) {
EXPECT_CALL(*data_type_manager, Configure(_, _)); EXPECT_CALL(*data_type_manager, Configure(_, _));
ON_CALL(*data_type_manager, state()) ON_CALL(*data_type_manager, state())
.WillByDefault(Return(DataTypeManager::CONFIGURED)); .WillByDefault(Return(DataTypeManager::CONFIGURED));
sync_service()->SetFirstSetupComplete(); sync_service()->GetUserSettings()->SetFirstSetupComplete();
// This should have fully enabled sync. // This should have fully enabled sync.
EXPECT_TRUE(sync_service()->IsSyncFeatureEnabled()); EXPECT_TRUE(sync_service()->IsSyncFeatureEnabled());
...@@ -370,7 +370,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartNoCredentials) { ...@@ -370,7 +370,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartNoCredentials) {
CreateSyncService(ProfileSyncService::MANUAL_START); CreateSyncService(ProfileSyncService::MANUAL_START);
sync_service()->SetFirstSetupComplete(); sync_service()->GetUserSettings()->SetFirstSetupComplete();
SetUpFakeSyncEngine(); SetUpFakeSyncEngine();
DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock(); DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock();
EXPECT_CALL(*data_type_manager, Configure(_, _)); EXPECT_CALL(*data_type_manager, Configure(_, _));
...@@ -393,7 +393,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartInvalidCredentials) { ...@@ -393,7 +393,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartInvalidCredentials) {
CreateSyncService(ProfileSyncService::MANUAL_START); CreateSyncService(ProfileSyncService::MANUAL_START);
sync_service()->SetFirstSetupComplete(); sync_service()->GetUserSettings()->SetFirstSetupComplete();
// Tell the engine to stall while downloading control types (simulating an // Tell the engine to stall while downloading control types (simulating an
// auth error). // auth error).
...@@ -438,7 +438,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartCrosNoCredentials) { ...@@ -438,7 +438,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartCrosNoCredentials) {
EXPECT_EQ(syncer::SyncService::TransportState::ACTIVE, EXPECT_EQ(syncer::SyncService::TransportState::ACTIVE,
sync_service()->GetTransportState()); sync_service()->GetTransportState());
// Since we're in AUTO_START mode, FirstSetupComplete gets set automatically. // Since we're in AUTO_START mode, FirstSetupComplete gets set automatically.
EXPECT_TRUE(sync_service()->IsFirstSetupComplete()); EXPECT_TRUE(sync_service()->GetUserSettings()->IsFirstSetupComplete());
} }
TEST_F(ProfileSyncServiceStartupTest, StartCrosFirstTime) { TEST_F(ProfileSyncServiceStartupTest, StartCrosFirstTime) {
...@@ -493,7 +493,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartNormal) { ...@@ -493,7 +493,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartNormal) {
TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest, StopSync) { TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest, StopSync) {
CreateSyncService(ProfileSyncService::MANUAL_START); CreateSyncService(ProfileSyncService::MANUAL_START);
SimulateTestUserSignin(); SimulateTestUserSignin();
sync_service()->SetFirstSetupComplete(); sync_service()->GetUserSettings()->SetFirstSetupComplete();
SetUpFakeSyncEngine(); SetUpFakeSyncEngine();
DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock(); DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock();
ON_CALL(*data_type_manager, state()) ON_CALL(*data_type_manager, state())
...@@ -503,7 +503,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest, StopSync) { ...@@ -503,7 +503,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest, StopSync) {
sync_service()->Initialize(); sync_service()->Initialize();
EXPECT_CALL(*data_type_manager, Stop(syncer::STOP_SYNC)); EXPECT_CALL(*data_type_manager, Stop(syncer::STOP_SYNC));
sync_service()->RequestStop(syncer::SyncService::KEEP_DATA); sync_service()->GetUserSettings()->SetSyncRequested(false);
EXPECT_FALSE(sync_service()->IsSyncFeatureEnabled()); EXPECT_FALSE(sync_service()->IsSyncFeatureEnabled());
EXPECT_FALSE(sync_service()->IsSyncFeatureActive()); EXPECT_FALSE(sync_service()->IsSyncFeatureActive());
...@@ -512,7 +512,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest, StopSync) { ...@@ -512,7 +512,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest, StopSync) {
TEST_F(ProfileSyncServiceWithStandaloneTransportStartupTest, StopSync) { TEST_F(ProfileSyncServiceWithStandaloneTransportStartupTest, StopSync) {
CreateSyncService(ProfileSyncService::MANUAL_START); CreateSyncService(ProfileSyncService::MANUAL_START);
SimulateTestUserSignin(); SimulateTestUserSignin();
sync_service()->SetFirstSetupComplete(); sync_service()->GetUserSettings()->SetFirstSetupComplete();
SetUpFakeSyncEngine(); SetUpFakeSyncEngine();
DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock(); DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock();
ON_CALL(*data_type_manager, state()) ON_CALL(*data_type_manager, state())
...@@ -527,7 +527,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportStartupTest, StopSync) { ...@@ -527,7 +527,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportStartupTest, StopSync) {
SetUpFakeSyncEngine(); SetUpFakeSyncEngine();
data_type_manager = SetUpDataTypeManagerMock(); data_type_manager = SetUpDataTypeManagerMock();
EXPECT_CALL(*data_type_manager, Configure(_, _)); EXPECT_CALL(*data_type_manager, Configure(_, _));
sync_service()->RequestStop(syncer::SyncService::KEEP_DATA); sync_service()->GetUserSettings()->SetSyncRequested(false);
// Sync-the-feature is still considered off. // Sync-the-feature is still considered off.
EXPECT_FALSE(sync_service()->IsSyncFeatureEnabled()); EXPECT_FALSE(sync_service()->IsSyncFeatureEnabled());
...@@ -537,7 +537,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportStartupTest, StopSync) { ...@@ -537,7 +537,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportStartupTest, StopSync) {
TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest, DisableSync) { TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest, DisableSync) {
CreateSyncService(ProfileSyncService::MANUAL_START); CreateSyncService(ProfileSyncService::MANUAL_START);
SimulateTestUserSignin(); SimulateTestUserSignin();
sync_service()->SetFirstSetupComplete(); sync_service()->GetUserSettings()->SetFirstSetupComplete();
SetUpFakeSyncEngine(); SetUpFakeSyncEngine();
DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock(); DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock();
ON_CALL(*data_type_manager, state()) ON_CALL(*data_type_manager, state())
...@@ -556,7 +556,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest, DisableSync) { ...@@ -556,7 +556,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest, DisableSync) {
TEST_F(ProfileSyncServiceWithStandaloneTransportStartupTest, DisableSync) { TEST_F(ProfileSyncServiceWithStandaloneTransportStartupTest, DisableSync) {
CreateSyncService(ProfileSyncService::MANUAL_START); CreateSyncService(ProfileSyncService::MANUAL_START);
SimulateTestUserSignin(); SimulateTestUserSignin();
sync_service()->SetFirstSetupComplete(); sync_service()->GetUserSettings()->SetFirstSetupComplete();
SetUpFakeSyncEngine(); SetUpFakeSyncEngine();
DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock(); DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock();
ON_CALL(*data_type_manager, state()) ON_CALL(*data_type_manager, state())
...@@ -590,7 +590,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartRecoverDatatypePrefs) { ...@@ -590,7 +590,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartRecoverDatatypePrefs) {
CreateSyncService(ProfileSyncService::MANUAL_START); CreateSyncService(ProfileSyncService::MANUAL_START);
SimulateTestUserSignin(); SimulateTestUserSignin();
sync_service()->SetFirstSetupComplete(); sync_service()->GetUserSettings()->SetFirstSetupComplete();
SetUpFakeSyncEngine(); SetUpFakeSyncEngine();
DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock(); DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock();
EXPECT_CALL(*data_type_manager, Configure(_, _)); EXPECT_CALL(*data_type_manager, Configure(_, _));
...@@ -612,7 +612,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartDontRecoverDatatypePrefs) { ...@@ -612,7 +612,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartDontRecoverDatatypePrefs) {
CreateSyncService(ProfileSyncService::MANUAL_START); CreateSyncService(ProfileSyncService::MANUAL_START);
SimulateTestUserSignin(); SimulateTestUserSignin();
sync_service()->SetFirstSetupComplete(); sync_service()->GetUserSettings()->SetFirstSetupComplete();
SetUpFakeSyncEngine(); SetUpFakeSyncEngine();
DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock(); DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock();
EXPECT_CALL(*data_type_manager, Configure(_, _)); EXPECT_CALL(*data_type_manager, Configure(_, _));
...@@ -643,7 +643,7 @@ TEST_F(ProfileSyncServiceStartupTest, ManagedStartup) { ...@@ -643,7 +643,7 @@ TEST_F(ProfileSyncServiceStartupTest, ManagedStartup) {
TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest, SwitchManaged) { TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest, SwitchManaged) {
CreateSyncService(ProfileSyncService::MANUAL_START); CreateSyncService(ProfileSyncService::MANUAL_START);
SimulateTestUserSignin(); SimulateTestUserSignin();
sync_service()->SetFirstSetupComplete(); sync_service()->GetUserSettings()->SetFirstSetupComplete();
SetUpFakeSyncEngine(); SetUpFakeSyncEngine();
DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock(); DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock();
EXPECT_CALL(*data_type_manager, Configure(_, _)); EXPECT_CALL(*data_type_manager, Configure(_, _));
...@@ -694,7 +694,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest, SwitchManaged) { ...@@ -694,7 +694,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest, SwitchManaged) {
TEST_F(ProfileSyncServiceWithStandaloneTransportStartupTest, SwitchManaged) { TEST_F(ProfileSyncServiceWithStandaloneTransportStartupTest, SwitchManaged) {
CreateSyncService(ProfileSyncService::MANUAL_START); CreateSyncService(ProfileSyncService::MANUAL_START);
SimulateTestUserSignin(); SimulateTestUserSignin();
sync_service()->SetFirstSetupComplete(); sync_service()->GetUserSettings()->SetFirstSetupComplete();
SetUpFakeSyncEngine(); SetUpFakeSyncEngine();
DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock(); DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock();
EXPECT_CALL(*data_type_manager, Configure(_, _)); EXPECT_CALL(*data_type_manager, Configure(_, _));
...@@ -752,7 +752,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportStartupTest, SwitchManaged) { ...@@ -752,7 +752,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportStartupTest, SwitchManaged) {
TEST_F(ProfileSyncServiceStartupTest, StartFailure) { TEST_F(ProfileSyncServiceStartupTest, StartFailure) {
CreateSyncService(ProfileSyncService::MANUAL_START); CreateSyncService(ProfileSyncService::MANUAL_START);
SimulateTestUserSignin(); SimulateTestUserSignin();
sync_service()->SetFirstSetupComplete(); sync_service()->GetUserSettings()->SetFirstSetupComplete();
SetUpFakeSyncEngine(); SetUpFakeSyncEngine();
DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock(); DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock();
DataTypeManager::ConfigureStatus status = DataTypeManager::ABORTED; DataTypeManager::ConfigureStatus status = DataTypeManager::ABORTED;
...@@ -846,7 +846,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest, ...@@ -846,7 +846,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportStartupTest,
// configuring the data types. Just marking the initial setup as complete // configuring the data types. Just marking the initial setup as complete
// isn't enough though, because setup is still considered in progress (we // isn't enough though, because setup is still considered in progress (we
// haven't released the setup-in-progress handle). // haven't released the setup-in-progress handle).
sync_service()->SetFirstSetupComplete(); sync_service()->GetUserSettings()->SetFirstSetupComplete();
EXPECT_EQ(syncer::SyncService::TransportState::PENDING_DESIRED_CONFIGURATION, EXPECT_EQ(syncer::SyncService::TransportState::PENDING_DESIRED_CONFIGURATION,
sync_service()->GetTransportState()); sync_service()->GetTransportState());
EXPECT_TRUE(sync_service()->IsSyncFeatureEnabled()); EXPECT_TRUE(sync_service()->IsSyncFeatureEnabled());
...@@ -931,7 +931,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportStartupTest, ...@@ -931,7 +931,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportStartupTest,
// configuring the data types. Just marking the initial setup as complete // configuring the data types. Just marking the initial setup as complete
// isn't enough though, because setup is still considered in progress (we // isn't enough though, because setup is still considered in progress (we
// haven't released the setup-in-progress handle). // haven't released the setup-in-progress handle).
sync_service()->SetFirstSetupComplete(); sync_service()->GetUserSettings()->SetFirstSetupComplete();
EXPECT_EQ(syncer::SyncService::TransportState::PENDING_DESIRED_CONFIGURATION, EXPECT_EQ(syncer::SyncService::TransportState::PENDING_DESIRED_CONFIGURATION,
sync_service()->GetTransportState()); sync_service()->GetTransportState());
EXPECT_TRUE(sync_service()->IsSyncFeatureEnabled()); EXPECT_TRUE(sync_service()->IsSyncFeatureEnabled());
......
...@@ -498,7 +498,7 @@ TEST_F(ProfileSyncServiceTest, DisabledByPolicyBeforeInitThenPolicyRemoved) { ...@@ -498,7 +498,7 @@ TEST_F(ProfileSyncServiceTest, DisabledByPolicyBeforeInitThenPolicyRemoved) {
// Once we mark first setup complete again (it was cleared by the policy) and // Once we mark first setup complete again (it was cleared by the policy) and
// sign in, sync starts up. // sign in, sync starts up.
service()->SetFirstSetupComplete(); service()->GetUserSettings()->SetFirstSetupComplete();
SignIn(); SignIn();
EXPECT_EQ(syncer::SyncService::TransportState::ACTIVE, EXPECT_EQ(syncer::SyncService::TransportState::ACTIVE,
service()->GetTransportState()); service()->GetTransportState());
...@@ -554,7 +554,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportTest, EarlyRequestStop) { ...@@ -554,7 +554,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportTest, EarlyRequestStop) {
service()->GetTransportState()); service()->GetTransportState());
// Request stop. Sync should get disabled. // Request stop. Sync should get disabled.
service()->RequestStop(ProfileSyncService::KEEP_DATA); service()->GetUserSettings()->SetSyncRequested(false);
EXPECT_EQ(syncer::SyncService::DISABLE_REASON_USER_CHOICE, EXPECT_EQ(syncer::SyncService::DISABLE_REASON_USER_CHOICE,
service()->GetDisableReasons()); service()->GetDisableReasons());
EXPECT_EQ(syncer::SyncService::TransportState::DISABLED, EXPECT_EQ(syncer::SyncService::TransportState::DISABLED,
...@@ -565,7 +565,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportTest, EarlyRequestStop) { ...@@ -565,7 +565,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportTest, EarlyRequestStop) {
// Sync should become active. // Sync should become active.
EXPECT_CALL(*component_factory(), CreateSyncEngine(_, _, _, _)) EXPECT_CALL(*component_factory(), CreateSyncEngine(_, _, _, _))
.WillOnce(ReturnNewFakeSyncEngine()); .WillOnce(ReturnNewFakeSyncEngine());
service()->RequestStart(); service()->GetUserSettings()->SetSyncRequested(true);
EXPECT_EQ(syncer::SyncService::DISABLE_REASON_NONE, EXPECT_EQ(syncer::SyncService::DISABLE_REASON_NONE,
service()->GetDisableReasons()); service()->GetDisableReasons());
EXPECT_EQ(syncer::SyncService::TransportState::ACTIVE, EXPECT_EQ(syncer::SyncService::TransportState::ACTIVE,
...@@ -589,7 +589,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportTest, EarlyRequestStop) { ...@@ -589,7 +589,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportTest, EarlyRequestStop) {
// transport mode. // transport mode.
EXPECT_CALL(*component_factory(), CreateSyncEngine(_, _, _, _)) EXPECT_CALL(*component_factory(), CreateSyncEngine(_, _, _, _))
.WillOnce(ReturnNewFakeSyncEngine()); .WillOnce(ReturnNewFakeSyncEngine());
service()->RequestStop(ProfileSyncService::KEEP_DATA); service()->GetUserSettings()->SetSyncRequested(false);
EXPECT_EQ(syncer::SyncService::DISABLE_REASON_USER_CHOICE, EXPECT_EQ(syncer::SyncService::DISABLE_REASON_USER_CHOICE,
service()->GetDisableReasons()); service()->GetDisableReasons());
EXPECT_EQ(syncer::SyncService::TransportState::ACTIVE, EXPECT_EQ(syncer::SyncService::TransportState::ACTIVE,
...@@ -598,7 +598,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportTest, EarlyRequestStop) { ...@@ -598,7 +598,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportTest, EarlyRequestStop) {
EXPECT_FALSE(service()->IsSyncFeatureEnabled()); EXPECT_FALSE(service()->IsSyncFeatureEnabled());
// Request start. Now Sync-the-feature should start again. // Request start. Now Sync-the-feature should start again.
service()->RequestStart(); service()->GetUserSettings()->SetSyncRequested(true);
EXPECT_EQ(syncer::SyncService::DISABLE_REASON_NONE, EXPECT_EQ(syncer::SyncService::DISABLE_REASON_NONE,
service()->GetDisableReasons()); service()->GetDisableReasons());
EXPECT_EQ(syncer::SyncService::TransportState::ACTIVE, EXPECT_EQ(syncer::SyncService::TransportState::ACTIVE,
...@@ -624,7 +624,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportTest, ...@@ -624,7 +624,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportTest,
testing::Mock::VerifyAndClearExpectations(component_factory()); testing::Mock::VerifyAndClearExpectations(component_factory());
service()->RequestStop(ProfileSyncService::KEEP_DATA); service()->GetUserSettings()->SetSyncRequested(false);
EXPECT_TRUE(prefs()->GetBoolean(syncer::prefs::kSyncSuppressStart)); EXPECT_TRUE(prefs()->GetBoolean(syncer::prefs::kSyncSuppressStart));
EXPECT_EQ(syncer::SyncService::DISABLE_REASON_USER_CHOICE, EXPECT_EQ(syncer::SyncService::DISABLE_REASON_USER_CHOICE,
service()->GetDisableReasons()); service()->GetDisableReasons());
...@@ -633,7 +633,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportTest, ...@@ -633,7 +633,7 @@ TEST_F(ProfileSyncServiceWithoutStandaloneTransportTest,
EXPECT_FALSE(service()->IsSyncFeatureActive()); EXPECT_FALSE(service()->IsSyncFeatureActive());
EXPECT_FALSE(service()->IsSyncFeatureEnabled()); EXPECT_FALSE(service()->IsSyncFeatureEnabled());
service()->RequestStart(); service()->GetUserSettings()->SetSyncRequested(true);
EXPECT_FALSE(prefs()->GetBoolean(syncer::prefs::kSyncSuppressStart)); EXPECT_FALSE(prefs()->GetBoolean(syncer::prefs::kSyncSuppressStart));
EXPECT_EQ(syncer::SyncService::DISABLE_REASON_NONE, EXPECT_EQ(syncer::SyncService::DISABLE_REASON_NONE,
service()->GetDisableReasons()); service()->GetDisableReasons());
...@@ -659,7 +659,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportTest, ...@@ -659,7 +659,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportTest,
testing::Mock::VerifyAndClearExpectations(component_factory()); testing::Mock::VerifyAndClearExpectations(component_factory());
service()->RequestStop(ProfileSyncService::KEEP_DATA); service()->GetUserSettings()->SetSyncRequested(false);
EXPECT_TRUE(prefs()->GetBoolean(syncer::prefs::kSyncSuppressStart)); EXPECT_TRUE(prefs()->GetBoolean(syncer::prefs::kSyncSuppressStart));
EXPECT_EQ(syncer::SyncService::DISABLE_REASON_USER_CHOICE, EXPECT_EQ(syncer::SyncService::DISABLE_REASON_USER_CHOICE,
service()->GetDisableReasons()); service()->GetDisableReasons());
...@@ -668,7 +668,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportTest, ...@@ -668,7 +668,7 @@ TEST_F(ProfileSyncServiceWithStandaloneTransportTest,
EXPECT_FALSE(service()->IsSyncFeatureActive()); EXPECT_FALSE(service()->IsSyncFeatureActive());
EXPECT_FALSE(service()->IsSyncFeatureEnabled()); EXPECT_FALSE(service()->IsSyncFeatureEnabled());
service()->RequestStart(); service()->GetUserSettings()->SetSyncRequested(true);
EXPECT_FALSE(prefs()->GetBoolean(syncer::prefs::kSyncSuppressStart)); EXPECT_FALSE(prefs()->GetBoolean(syncer::prefs::kSyncSuppressStart));
EXPECT_EQ(syncer::SyncService::DISABLE_REASON_NONE, EXPECT_EQ(syncer::SyncService::DISABLE_REASON_NONE,
service()->GetDisableReasons()); service()->GetDisableReasons());
...@@ -1098,8 +1098,7 @@ TEST_F(ProfileSyncServiceTest, MemoryPressureRecording) { ...@@ -1098,8 +1098,7 @@ TEST_F(ProfileSyncServiceTest, MemoryPressureRecording) {
testing::Mock::VerifyAndClearExpectations(component_factory()); testing::Mock::VerifyAndClearExpectations(component_factory());
syncer::SyncPrefs sync_prefs( syncer::SyncPrefs sync_prefs(prefs());
service()->GetSyncClientForTest()->GetPrefService());
ASSERT_EQ(prefs()->GetInteger(syncer::prefs::kSyncMemoryPressureWarningCount), ASSERT_EQ(prefs()->GetInteger(syncer::prefs::kSyncMemoryPressureWarningCount),
0); 0);
...@@ -1321,8 +1320,7 @@ TEST_F(ProfileSyncServiceTest, PassphrasePromptDueToVersion) { ...@@ -1321,8 +1320,7 @@ TEST_F(ProfileSyncServiceTest, PassphrasePromptDueToVersion) {
CreateService(ProfileSyncService::AUTO_START); CreateService(ProfileSyncService::AUTO_START);
InitializeForNthSync(); InitializeForNthSync();
syncer::SyncPrefs sync_prefs( syncer::SyncPrefs sync_prefs(prefs());
service()->GetSyncClientForTest()->GetPrefService());
ASSERT_EQ(PRODUCT_VERSION, sync_prefs.GetLastRunVersion()); ASSERT_EQ(PRODUCT_VERSION, sync_prefs.GetLastRunVersion());
sync_prefs.SetPassphrasePrompted(true); sync_prefs.SetPassphrasePrompted(true);
...@@ -1470,7 +1468,7 @@ TEST_F(ProfileSyncServiceTest, LocalBackendDisabledByPolicy) { ...@@ -1470,7 +1468,7 @@ TEST_F(ProfileSyncServiceTest, LocalBackendDisabledByPolicy) {
prefs()->SetManagedPref(syncer::prefs::kSyncManaged, prefs()->SetManagedPref(syncer::prefs::kSyncManaged,
std::make_unique<base::Value>(false)); std::make_unique<base::Value>(false));
service()->RequestStart(); service()->GetUserSettings()->SetSyncRequested(true);
EXPECT_EQ(syncer::SyncService::DISABLE_REASON_NONE, EXPECT_EQ(syncer::SyncService::DISABLE_REASON_NONE,
service()->GetDisableReasons()); service()->GetDisableReasons());
EXPECT_EQ(syncer::SyncService::TransportState::ACTIVE, EXPECT_EQ(syncer::SyncService::TransportState::ACTIVE,
......
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