OLD | NEW |
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 // 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 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 GetEncryptedTypes(trans->GetWrappedTrans()); | 904 GetEncryptedTypes(trans->GetWrappedTrans()); |
905 } | 905 } |
906 | 906 |
907 void SimulateInvalidatorStateChangeForTest(InvalidatorState state) { | 907 void SimulateInvalidatorStateChangeForTest(InvalidatorState state) { |
908 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); | 908 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); |
909 sync_manager_.OnInvalidatorStateChange(state); | 909 sync_manager_.OnInvalidatorStateChange(state); |
910 } | 910 } |
911 | 911 |
912 void TriggerOnIncomingNotificationForTest(ModelTypeSet model_types) { | 912 void TriggerOnIncomingNotificationForTest(ModelTypeSet model_types) { |
913 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); | 913 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); |
914 ModelTypeStateMap type_state_map = | 914 ModelTypeInvalidationMap invalidation_map = |
915 ModelTypeSetToStateMap(model_types, std::string()); | 915 ModelTypeSetToInvalidationMap(model_types, std::string()); |
916 sync_manager_.OnIncomingInvalidation( | 916 sync_manager_.OnIncomingInvalidation( |
917 ModelTypeStateMapToObjectIdStateMap(type_state_map), | 917 ModelTypeInvalidationMapToObjectIdInvalidationMap( |
| 918 invalidation_map), |
918 REMOTE_INVALIDATION); | 919 REMOTE_INVALIDATION); |
919 } | 920 } |
920 | 921 |
921 void SetProgressMarkerForType(ModelType type, bool set) { | 922 void SetProgressMarkerForType(ModelType type, bool set) { |
922 if (set) { | 923 if (set) { |
923 sync_pb::DataTypeProgressMarker marker; | 924 sync_pb::DataTypeProgressMarker marker; |
924 marker.set_token("token"); | 925 marker.set_token("token"); |
925 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); | 926 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); |
926 sync_manager_.directory()->SetDownloadProgress(type, marker); | 927 sync_manager_.directory()->SetDownloadProgress(type, marker); |
927 } else { | 928 } else { |
(...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2882 | 2883 |
2883 // Verify only the non-disabled types remain after cleanup. | 2884 // Verify only the non-disabled types remain after cleanup. |
2884 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types); | 2885 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types); |
2885 EXPECT_TRUE(new_enabled_types.Equals( | 2886 EXPECT_TRUE(new_enabled_types.Equals( |
2886 Union(sync_manager_.InitialSyncEndedTypes(), partial_enabled_types))); | 2887 Union(sync_manager_.InitialSyncEndedTypes(), partial_enabled_types))); |
2887 EXPECT_TRUE(disabled_types.Equals( | 2888 EXPECT_TRUE(disabled_types.Equals( |
2888 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); | 2889 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); |
2889 } | 2890 } |
2890 | 2891 |
2891 } // namespace | 2892 } // namespace |
OLD | NEW |