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

Unified Diff: components/browser_sync/browser/profile_sync_service_unittest.cc

Issue 1976423002: [sync] Sign user out of Chrome on dashboard stop and reset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/browser/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/browser/profile_sync_service_unittest.cc
diff --git a/components/browser_sync/browser/profile_sync_service_unittest.cc b/components/browser_sync/browser/profile_sync_service_unittest.cc
index 7369677134b0e36f025c5f324d1e28e40691f616..d64eda59c862cb580b2a0ee8554480e1ff9642fe 100644
--- a/components/browser_sync/browser/profile_sync_service_unittest.cc
+++ b/components/browser_sync/browser/profile_sync_service_unittest.cc
@@ -904,6 +904,37 @@ TEST_F(ProfileSyncServiceTest, ResetSyncData) {
service()->OnActionableError(client_cmd);
}
+// Test that when ProfileSyncService receives actionable error
+// DISABLE_SYNC_ON_CLIENT it disables sync and signs out.
+TEST_F(ProfileSyncServiceTest, DisableSyncOnClient) {
+ IssueTestTokens();
+ CreateService(ProfileSyncService::AUTO_START);
+ ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback());
+ ExpectSyncBackendHostCreation(1);
+ InitializeForNthSync();
+
+ EXPECT_TRUE(service()->IsSyncActive());
+ EXPECT_EQ(l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW),
+ service()->GetLastSyncedTimeString());
+ EXPECT_TRUE(service()->GetLocalDeviceInfoProvider()->GetLocalDeviceInfo());
+
+ syncer::SyncProtocolError client_cmd;
+ client_cmd.action = syncer::DISABLE_SYNC_ON_CLIENT;
+ service()->OnActionableError(client_cmd);
+
+// CrOS does not support signout.
+#if !defined(OS_CHROMEOS)
+ EXPECT_TRUE(signin_manager()->GetAuthenticatedAccountId().empty());
+#else
+ EXPECT_FALSE(signin_manager()->GetAuthenticatedAccountId().empty());
+#endif
+
+ EXPECT_FALSE(service()->IsSyncActive());
+ EXPECT_EQ(l10n_util::GetStringUTF16(IDS_SYNC_TIME_NEVER),
+ service()->GetLastSyncedTimeString());
+ EXPECT_FALSE(service()->GetLocalDeviceInfoProvider()->GetLocalDeviceInfo());
+}
+
// 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/browser/profile_sync_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698