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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/browser_sync/browser/profile_sync_service.h" 5 #include "components/browser_sync/browser/profile_sync_service.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 // once when handling actionable error. 897 // once when handling actionable error.
898 ExpectDataTypeManagerCreation(2, GetDefaultConfigureCalledCallback()); 898 ExpectDataTypeManagerCreation(2, GetDefaultConfigureCalledCallback());
899 ExpectSyncBackendHostCreation(2); 899 ExpectSyncBackendHostCreation(2);
900 InitializeForNthSync(); 900 InitializeForNthSync();
901 901
902 syncer::SyncProtocolError client_cmd; 902 syncer::SyncProtocolError client_cmd;
903 client_cmd.action = syncer::RESET_LOCAL_SYNC_DATA; 903 client_cmd.action = syncer::RESET_LOCAL_SYNC_DATA;
904 service()->OnActionableError(client_cmd); 904 service()->OnActionableError(client_cmd);
905 } 905 }
906 906
907 // Test that when ProfileSyncService receives actionable error
908 // DISABLE_SYNC_ON_CLIENT it disables sync and signs out.
909 // CrOS does not support signout.
910 #if !defined(OS_CHROMEOS)
911 TEST_F(ProfileSyncServiceTest, DisableSyncOnClient) {
912 IssueTestTokens();
913 CreateService(ProfileSyncService::AUTO_START);
914 ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback());
915 ExpectSyncBackendHostCreation(1);
916 InitializeForNthSync();
917
918 EXPECT_TRUE(service()->IsSyncActive());
919 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW),
920 service()->GetLastSyncedTimeString());
921 EXPECT_TRUE(service()->GetLocalDeviceInfoProvider()->GetLocalDeviceInfo());
922
923 syncer::SyncProtocolError client_cmd;
924 client_cmd.action = syncer::DISABLE_SYNC_ON_CLIENT;
925 service()->OnActionableError(client_cmd);
926
927 EXPECT_FALSE(service()->IsSyncActive());
928 EXPECT_TRUE(service()->GetAccessTokenForTest().empty());
929 EXPECT_TRUE(signin_manager()->GetAuthenticatedAccountId().empty());
maxbogue 2016/05/16 22:51:02 You could move the #if inside the test and have an
Patrick Noland 2016/05/17 21:30:07 Done.
930
931 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_SYNC_TIME_NEVER),
932 service()->GetLastSyncedTimeString());
933 EXPECT_FALSE(service()->GetLocalDeviceInfoProvider()->GetLocalDeviceInfo());
934 }
935 #endif
936
907 // Regression test for crbug/555434. The issue is that check for sessions DTC in 937 // Regression test for crbug/555434. The issue is that check for sessions DTC in
908 // OnSessionRestoreComplete was creating map entry with nullptr which later was 938 // OnSessionRestoreComplete was creating map entry with nullptr which later was
909 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if 939 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if
910 // entry for sessions exists in map. 940 // entry for sessions exists in map.
911 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) { 941 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) {
912 CreateService(ProfileSyncService::AUTO_START); 942 CreateService(ProfileSyncService::AUTO_START);
913 service()->OnSessionRestoreComplete(); 943 service()->OnSessionRestoreComplete();
914 service()->OnSyncCycleCompleted(); 944 service()->OnSyncCycleCompleted();
915 } 945 }
916 946
917 } // namespace 947 } // namespace
918 } // namespace browser_sync 948 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698