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

Side by Side Diff: components/browser_sync/profile_sync_service_unittest.cc

Issue 2624943002: [Sync] Move snapshot cache from SBHI to PSS. (Closed)
Patch Set: Address comments. Created 3 years, 11 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/profile_sync_service.h" 5 #include "components/browser_sync/profile_sync_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 EXPECT_FALSE(service()->GetLocalDeviceInfoProvider()->GetLocalDeviceInfo()); 934 EXPECT_FALSE(service()->GetLocalDeviceInfoProvider()->GetLocalDeviceInfo());
935 } 935 }
936 936
937 // 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
938 // OnSessionRestoreComplete was creating map entry with nullptr which later was 938 // OnSessionRestoreComplete was creating map entry with nullptr which later was
939 // 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
940 // entry for sessions exists in map. 940 // entry for sessions exists in map.
941 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) { 941 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) {
942 CreateService(ProfileSyncService::AUTO_START); 942 CreateService(ProfileSyncService::AUTO_START);
943 service()->OnSessionRestoreComplete(); 943 service()->OnSessionRestoreComplete();
944 service()->OnSyncCycleCompleted(); 944 service()->OnSyncCycleCompleted(syncer::SyncCycleSnapshot());
945 } 945 }
946 946
947 // The OpenTabsUIDelegate should only be accessable when PROXY_TABS is enabled. 947 // The OpenTabsUIDelegate should only be accessable when PROXY_TABS is enabled.
948 TEST_F(ProfileSyncServiceTest, GetOpenTabsUIDelegate) { 948 TEST_F(ProfileSyncServiceTest, GetOpenTabsUIDelegate) {
949 CreateService(ProfileSyncService::AUTO_START); 949 CreateService(ProfileSyncService::AUTO_START);
950 InitializeForNthSync(); 950 InitializeForNthSync();
951 EXPECT_EQ(nullptr, service()->GetOpenTabsUIDelegate()); 951 EXPECT_EQ(nullptr, service()->GetOpenTabsUIDelegate());
952 952
953 auto controller = 953 auto controller =
954 base::MakeUnique<syncer::FakeDataTypeController>(syncer::PROXY_TABS); 954 base::MakeUnique<syncer::FakeDataTypeController>(syncer::PROXY_TABS);
955 // Progress the controller to RUNNING first, which is how the service 955 // Progress the controller to RUNNING first, which is how the service
956 // determines whether a type is enabled. 956 // determines whether a type is enabled.
957 controller->StartAssociating(base::Bind(&DoNothing)); 957 controller->StartAssociating(base::Bind(&DoNothing));
958 controller->FinishStart(DataTypeController::OK_FIRST_RUN); 958 controller->FinishStart(DataTypeController::OK_FIRST_RUN);
959 service()->RegisterDataTypeController(std::move(controller)); 959 service()->RegisterDataTypeController(std::move(controller));
960 EXPECT_NE(nullptr, service()->GetOpenTabsUIDelegate()); 960 EXPECT_NE(nullptr, service()->GetOpenTabsUIDelegate());
961 } 961 }
962 962
963 } // namespace 963 } // namespace
964 } // namespace browser_sync 964 } // namespace browser_sync
OLDNEW
« no previous file with comments | « components/browser_sync/profile_sync_service_mock.h ('k') | components/sync/driver/glue/sync_backend_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698