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

Side by Side Diff: sync/internal_api/sync_manager_impl_unittest.cc

Issue 322333004: sync: Inject sync/'s dependency on invalidations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « sync/internal_api/sync_manager_impl.cc ('k') | sync/internal_api/sync_rollback_manager_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 // Unit tests for the SyncApi. Note that a lot of the underlying 5 // Unit tests for the SyncApi. Note that a lot of the underlying
6 // functionality is provided by the Syncable layer, which has its own 6 // functionality is provided by the Syncable layer, which has its own
7 // unit tests. We'll test SyncApi specific things in this harness. 7 // unit tests. We'll test SyncApi specific things in this harness.
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <map> 10 #include <map>
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 ModelTypeSet GetEncryptedTypesWithTrans(BaseTransaction* trans) { 976 ModelTypeSet GetEncryptedTypesWithTrans(BaseTransaction* trans) {
977 return trans->GetDirectory()->GetNigoriHandler()-> 977 return trans->GetDirectory()->GetNigoriHandler()->
978 GetEncryptedTypes(trans->GetWrappedTrans()); 978 GetEncryptedTypes(trans->GetWrappedTrans());
979 } 979 }
980 980
981 void SimulateInvalidatorStateChangeForTest(InvalidatorState state) { 981 void SimulateInvalidatorStateChangeForTest(InvalidatorState state) {
982 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); 982 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread());
983 sync_manager_.OnInvalidatorStateChange(state); 983 sync_manager_.OnInvalidatorStateChange(state);
984 } 984 }
985 985
986 void TriggerOnIncomingNotificationForTest(ModelTypeSet model_types) {
987 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread());
988 ObjectIdSet id_set = ModelTypeSetToObjectIdSet(model_types);
989 ObjectIdInvalidationMap invalidation_map =
990 ObjectIdInvalidationMap::InvalidateAll(id_set);
991 sync_manager_.OnIncomingInvalidation(invalidation_map);
992 }
993
994 void SetProgressMarkerForType(ModelType type, bool set) { 986 void SetProgressMarkerForType(ModelType type, bool set) {
995 if (set) { 987 if (set) {
996 sync_pb::DataTypeProgressMarker marker; 988 sync_pb::DataTypeProgressMarker marker;
997 marker.set_token("token"); 989 marker.set_token("token");
998 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); 990 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type));
999 sync_manager_.directory()->SetDownloadProgress(type, marker); 991 sync_manager_.directory()->SetDownloadProgress(type, marker);
1000 } else { 992 } else {
1001 sync_pb::DataTypeProgressMarker marker; 993 sync_pb::DataTypeProgressMarker marker;
1002 sync_manager_.directory()->SetDownloadProgress(type, marker); 994 sync_manager_.directory()->SetDownloadProgress(type, marker);
1003 } 995 }
(...skipping 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3136 // SyncManagerInitInvalidStorageTest::GetFactory will return 3128 // SyncManagerInitInvalidStorageTest::GetFactory will return
3137 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. 3129 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails.
3138 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's 3130 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's
3139 // task is to ensure that SyncManagerImpl reported initialization failure in 3131 // task is to ensure that SyncManagerImpl reported initialization failure in
3140 // OnInitializationComplete callback. 3132 // OnInitializationComplete callback.
3141 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { 3133 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) {
3142 EXPECT_FALSE(initialization_succeeded_); 3134 EXPECT_FALSE(initialization_succeeded_);
3143 } 3135 }
3144 3136
3145 } // namespace syncer 3137 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/sync_manager_impl.cc ('k') | sync/internal_api/sync_rollback_manager_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698