| OLD | NEW |
| 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 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 ModelTypeSet GetEncryptedTypes() { | 970 ModelTypeSet GetEncryptedTypes() { |
| 971 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); | 971 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); |
| 972 return GetEncryptedTypesWithTrans(&trans); | 972 return GetEncryptedTypesWithTrans(&trans); |
| 973 } | 973 } |
| 974 | 974 |
| 975 ModelTypeSet GetEncryptedTypesWithTrans(BaseTransaction* trans) { | 975 ModelTypeSet GetEncryptedTypesWithTrans(BaseTransaction* trans) { |
| 976 return trans->GetDirectory()->GetNigoriHandler()-> | 976 return trans->GetDirectory()->GetNigoriHandler()-> |
| 977 GetEncryptedTypes(trans->GetWrappedTrans()); | 977 GetEncryptedTypes(trans->GetWrappedTrans()); |
| 978 } | 978 } |
| 979 | 979 |
| 980 void SimulateInvalidatorStateChangeForTest(InvalidatorState state) { | 980 void SimulateInvalidatorEnabledForTest(bool is_enabled) { |
| 981 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); | 981 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); |
| 982 sync_manager_.SetInvalidatorEnabled(state == INVALIDATIONS_ENABLED); | 982 sync_manager_.SetInvalidatorEnabled(is_enabled); |
| 983 } | 983 } |
| 984 | 984 |
| 985 void SetProgressMarkerForType(ModelType type, bool set) { | 985 void SetProgressMarkerForType(ModelType type, bool set) { |
| 986 if (set) { | 986 if (set) { |
| 987 sync_pb::DataTypeProgressMarker marker; | 987 sync_pb::DataTypeProgressMarker marker; |
| 988 marker.set_token("token"); | 988 marker.set_token("token"); |
| 989 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); | 989 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); |
| 990 sync_manager_.directory()->SetDownloadProgress(type, marker); | 990 sync_manager_.directory()->SetDownloadProgress(type, marker); |
| 991 } else { | 991 } else { |
| 992 sync_pb::DataTypeProgressMarker marker; | 992 sync_pb::DataTypeProgressMarker marker; |
| (...skipping 2196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3189 // SyncManagerInitInvalidStorageTest::GetFactory will return | 3189 // SyncManagerInitInvalidStorageTest::GetFactory will return |
| 3190 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. | 3190 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. |
| 3191 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's | 3191 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's |
| 3192 // task is to ensure that SyncManagerImpl reported initialization failure in | 3192 // task is to ensure that SyncManagerImpl reported initialization failure in |
| 3193 // OnInitializationComplete callback. | 3193 // OnInitializationComplete callback. |
| 3194 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { | 3194 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { |
| 3195 EXPECT_FALSE(initialization_succeeded_); | 3195 EXPECT_FALSE(initialization_succeeded_); |
| 3196 } | 3196 } |
| 3197 | 3197 |
| 3198 } // namespace syncer | 3198 } // namespace syncer |
| OLD | NEW |