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 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 } | 935 } |
936 | 936 |
937 void SimulateDisableNotificationsForTest( | 937 void SimulateDisableNotificationsForTest( |
938 NotificationsDisabledReason reason) { | 938 NotificationsDisabledReason reason) { |
939 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); | 939 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); |
940 sync_manager_.OnNotificationsDisabled(reason); | 940 sync_manager_.OnNotificationsDisabled(reason); |
941 } | 941 } |
942 | 942 |
943 void TriggerOnIncomingNotificationForTest(ModelTypeSet model_types) { | 943 void TriggerOnIncomingNotificationForTest(ModelTypeSet model_types) { |
944 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); | 944 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); |
945 ModelTypePayloadMap model_types_with_payloads = | 945 ModelTypeStateMap type_state_map = |
946 ModelTypePayloadMapFromEnumSet(model_types, std::string()); | 946 ModelTypeSetToStateMap(model_types, std::string()); |
947 sync_manager_.OnIncomingNotification( | 947 sync_manager_.OnIncomingNotification( |
948 ModelTypePayloadMapToObjectIdPayloadMap(model_types_with_payloads), | 948 ModelTypeStateMapToObjectIdStateMap(type_state_map), |
949 REMOTE_NOTIFICATION); | 949 REMOTE_NOTIFICATION); |
950 } | 950 } |
951 | 951 |
952 void SetProgressMarkerForType(ModelType type, bool set) { | 952 void SetProgressMarkerForType(ModelType type, bool set) { |
953 if (set) { | 953 if (set) { |
954 sync_pb::DataTypeProgressMarker marker; | 954 sync_pb::DataTypeProgressMarker marker; |
955 marker.set_token("token"); | 955 marker.set_token("token"); |
956 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); | 956 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); |
957 sync_manager_.directory()->SetDownloadProgress(type, marker); | 957 sync_manager_.directory()->SetDownloadProgress(type, marker); |
958 } else { | 958 } else { |
(...skipping 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2890 | 2890 |
2891 // Verify only the non-disabled types remain after cleanup. | 2891 // Verify only the non-disabled types remain after cleanup. |
2892 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types); | 2892 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types); |
2893 EXPECT_TRUE(new_enabled_types.Equals( | 2893 EXPECT_TRUE(new_enabled_types.Equals( |
2894 Union(sync_manager_.InitialSyncEndedTypes(), partial_enabled_types))); | 2894 Union(sync_manager_.InitialSyncEndedTypes(), partial_enabled_types))); |
2895 EXPECT_TRUE(disabled_types.Equals( | 2895 EXPECT_TRUE(disabled_types.Equals( |
2896 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); | 2896 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); |
2897 } | 2897 } |
2898 | 2898 |
2899 } // namespace | 2899 } // namespace |
OLD | NEW |