Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: components/browser_sync/profile_sync_service_unittest.cc

Issue 2810943007: Allow sync to resume in local backend mode after it has been disabled. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/browser_sync/profile_sync_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/browser_sync/profile_sync_service_unittest.cc
diff --git a/components/browser_sync/profile_sync_service_unittest.cc b/components/browser_sync/profile_sync_service_unittest.cc
index fc0d17f4356cdd56abf2c413b5ee55c6d9f30ac4..4dd3cb85a24675b73f3981bd21573c7723b0f22f 100644
--- a/components/browser_sync/profile_sync_service_unittest.cc
+++ b/components/browser_sync/profile_sync_service_unittest.cc
@@ -386,7 +386,6 @@ TEST_F(ProfileSyncServiceTest, SuccessfulInitialization) {
TEST_F(ProfileSyncServiceTest, SuccessfulLocalBackendInitialization) {
prefs()->SetManagedPref(syncer::prefs::kSyncManaged,
base::MakeUnique<base::Value>(false));
- IssueTestTokens();
CreateServiceWithLocalSyncBackend();
ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback());
ExpectSyncEngineCreation(1);
@@ -943,6 +942,34 @@ TEST_F(ProfileSyncServiceTest, DisableSyncOnClient) {
EXPECT_FALSE(service()->GetLocalDeviceInfoProvider()->GetLocalDeviceInfo());
}
+// Verify a that local sync mode resumes after the policy is lifted.
+TEST_F(ProfileSyncServiceTest, LocalBackendDisabledByPolicy) {
+ prefs()->SetManagedPref(syncer::prefs::kSyncManaged,
+ base::MakeUnique<base::Value>(false));
+ CreateServiceWithLocalSyncBackend();
+ ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback());
+ ExpectSyncEngineCreation(1);
+ InitializeForNthSync();
+ EXPECT_FALSE(service()->IsManaged());
+ EXPECT_TRUE(service()->IsSyncActive());
+
+ prefs()->SetManagedPref(syncer::prefs::kSyncManaged,
+ base::MakeUnique<base::Value>(true));
+
+ EXPECT_TRUE(service()->IsManaged());
+ EXPECT_FALSE(service()->IsSyncActive());
+
+ prefs()->SetManagedPref(syncer::prefs::kSyncManaged,
+ base::MakeUnique<base::Value>(false));
+
+ ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback());
+ ExpectSyncEngineCreation(1);
+
+ service()->RequestStart();
+ EXPECT_FALSE(service()->IsManaged());
+ EXPECT_TRUE(service()->IsSyncActive());
+}
+
// Regression test for crbug/555434. The issue is that check for sessions DTC in
// OnSessionRestoreComplete was creating map entry with nullptr which later was
// dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if
« no previous file with comments | « components/browser_sync/profile_sync_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698