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 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 } | 911 } |
912 | 912 |
913 void SimulateDisableNotificationsForTest( | 913 void SimulateDisableNotificationsForTest( |
914 NotificationsDisabledReason reason) { | 914 NotificationsDisabledReason reason) { |
915 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); | 915 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); |
916 sync_manager_.OnNotificationsDisabled(reason); | 916 sync_manager_.OnNotificationsDisabled(reason); |
917 } | 917 } |
918 | 918 |
919 void TriggerOnIncomingNotificationForTest(ModelTypeSet model_types) { | 919 void TriggerOnIncomingNotificationForTest(ModelTypeSet model_types) { |
920 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); | 920 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); |
921 ModelTypePayloadMap model_types_with_payloads = | 921 ModelTypeStateMap type_state_map = |
922 ModelTypePayloadMapFromEnumSet(model_types, std::string()); | 922 ModelTypeStateMapFromEnumSet(model_types, std::string()); |
923 sync_manager_.OnIncomingNotification( | 923 sync_manager_.OnIncomingNotification( |
924 ModelTypePayloadMapToObjectIdPayloadMap(model_types_with_payloads), | 924 ModelTypeStateMapToObjectIdStateMap(type_state_map), |
925 REMOTE_NOTIFICATION); | 925 REMOTE_NOTIFICATION); |
926 } | 926 } |
927 | 927 |
928 void SetProgressMarkerForType(ModelType type, bool set) { | 928 void SetProgressMarkerForType(ModelType type, bool set) { |
929 if (set) { | 929 if (set) { |
930 sync_pb::DataTypeProgressMarker marker; | 930 sync_pb::DataTypeProgressMarker marker; |
931 marker.set_token("token"); | 931 marker.set_token("token"); |
932 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); | 932 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); |
933 sync_manager_.directory()->SetDownloadProgress(type, marker); | 933 sync_manager_.directory()->SetDownloadProgress(type, marker); |
934 } else { | 934 } else { |
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2800 | 2800 |
2801 // Verify only the non-disabled types remain after cleanup. | 2801 // Verify only the non-disabled types remain after cleanup. |
2802 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types); | 2802 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types); |
2803 EXPECT_TRUE(new_enabled_types.Equals( | 2803 EXPECT_TRUE(new_enabled_types.Equals( |
2804 Union(sync_manager_.InitialSyncEndedTypes(), partial_enabled_types))); | 2804 Union(sync_manager_.InitialSyncEndedTypes(), partial_enabled_types))); |
2805 EXPECT_TRUE(disabled_types.Equals( | 2805 EXPECT_TRUE(disabled_types.Equals( |
2806 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); | 2806 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); |
2807 } | 2807 } |
2808 | 2808 |
2809 } // namespace | 2809 } // namespace |
OLD | NEW |