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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); | 966 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); |
967 sync_manager_.OnInvalidatorStateChange(state); | 967 sync_manager_.OnInvalidatorStateChange(state); |
968 } | 968 } |
969 | 969 |
970 void TriggerOnIncomingNotificationForTest(ModelTypeSet model_types) { | 970 void TriggerOnIncomingNotificationForTest(ModelTypeSet model_types) { |
971 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); | 971 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); |
972 ModelTypeInvalidationMap invalidation_map = | 972 ModelTypeInvalidationMap invalidation_map = |
973 ModelTypeSetToInvalidationMap(model_types, std::string()); | 973 ModelTypeSetToInvalidationMap(model_types, std::string()); |
974 sync_manager_.OnIncomingInvalidation( | 974 sync_manager_.OnIncomingInvalidation( |
975 ModelTypeInvalidationMapToObjectIdInvalidationMap( | 975 ModelTypeInvalidationMapToObjectIdInvalidationMap( |
976 invalidation_map), | 976 invalidation_map)); |
977 REMOTE_INVALIDATION); | |
978 } | 977 } |
979 | 978 |
980 void SetProgressMarkerForType(ModelType type, bool set) { | 979 void SetProgressMarkerForType(ModelType type, bool set) { |
981 if (set) { | 980 if (set) { |
982 sync_pb::DataTypeProgressMarker marker; | 981 sync_pb::DataTypeProgressMarker marker; |
983 marker.set_token("token"); | 982 marker.set_token("token"); |
984 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); | 983 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); |
985 sync_manager_.directory()->SetDownloadProgress(type, marker); | 984 sync_manager_.directory()->SetDownloadProgress(type, marker); |
986 } else { | 985 } else { |
987 sync_pb::DataTypeProgressMarker marker; | 986 sync_pb::DataTypeProgressMarker marker; |
(...skipping 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3050 | 3049 |
3051 // Verify only the non-disabled types remain after cleanup. | 3050 // Verify only the non-disabled types remain after cleanup. |
3052 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types, | 3051 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types, |
3053 ModelTypeSet()); | 3052 ModelTypeSet()); |
3054 EXPECT_TRUE(new_enabled_types.Equals(sync_manager_.InitialSyncEndedTypes())); | 3053 EXPECT_TRUE(new_enabled_types.Equals(sync_manager_.InitialSyncEndedTypes())); |
3055 EXPECT_TRUE(disabled_types.Equals( | 3054 EXPECT_TRUE(disabled_types.Equals( |
3056 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); | 3055 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); |
3057 } | 3056 } |
3058 | 3057 |
3059 } // namespace | 3058 } // namespace |
OLD | NEW |