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

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: Add missing files Created 6 years, 6 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
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 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 ModelTypeSet GetEncryptedTypesWithTrans(BaseTransaction* trans) { 972 ModelTypeSet GetEncryptedTypesWithTrans(BaseTransaction* trans) {
973 return trans->GetDirectory()->GetNigoriHandler()-> 973 return trans->GetDirectory()->GetNigoriHandler()->
974 GetEncryptedTypes(trans->GetWrappedTrans()); 974 GetEncryptedTypes(trans->GetWrappedTrans());
975 } 975 }
976 976
977 void SimulateInvalidatorStateChangeForTest(InvalidatorState state) { 977 void SimulateInvalidatorStateChangeForTest(InvalidatorState state) {
978 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); 978 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread());
979 sync_manager_.OnInvalidatorStateChange(state); 979 sync_manager_.OnInvalidatorStateChange(state);
980 } 980 }
981 981
982 void TriggerOnIncomingNotificationForTest(ModelTypeSet model_types) {
983 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread());
984 ObjectIdSet id_set = ModelTypeSetToObjectIdSet(model_types);
985 ObjectIdInvalidationMap invalidation_map =
986 ObjectIdInvalidationMap::InvalidateAll(id_set);
987 sync_manager_.OnIncomingInvalidation(invalidation_map);
988 }
989
990 void SetProgressMarkerForType(ModelType type, bool set) { 982 void SetProgressMarkerForType(ModelType type, bool set) {
991 if (set) { 983 if (set) {
992 sync_pb::DataTypeProgressMarker marker; 984 sync_pb::DataTypeProgressMarker marker;
993 marker.set_token("token"); 985 marker.set_token("token");
994 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); 986 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type));
995 sync_manager_.directory()->SetDownloadProgress(type, marker); 987 sync_manager_.directory()->SetDownloadProgress(type, marker);
996 } else { 988 } else {
997 sync_pb::DataTypeProgressMarker marker; 989 sync_pb::DataTypeProgressMarker marker;
998 sync_manager_.directory()->SetDownloadProgress(type, marker); 990 sync_manager_.directory()->SetDownloadProgress(type, marker);
999 } 991 }
(...skipping 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3132 // SyncManagerInitInvalidStorageTest::GetFactory will return 3124 // SyncManagerInitInvalidStorageTest::GetFactory will return
3133 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. 3125 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails.
3134 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's 3126 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's
3135 // task is to ensure that SyncManagerImpl reported initialization failure in 3127 // task is to ensure that SyncManagerImpl reported initialization failure in
3136 // OnInitializationComplete callback. 3128 // OnInitializationComplete callback.
3137 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { 3129 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) {
3138 EXPECT_FALSE(initialization_succeeded_); 3130 EXPECT_FALSE(initialization_succeeded_);
3139 } 3131 }
3140 3132
3141 } // namespace syncer 3133 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698