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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 GetEncryptedTypes(trans->GetWrappedTrans()); | 975 GetEncryptedTypes(trans->GetWrappedTrans()); |
976 } | 976 } |
977 | 977 |
978 void SimulateInvalidatorStateChangeForTest(InvalidatorState state) { | 978 void SimulateInvalidatorStateChangeForTest(InvalidatorState state) { |
979 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); | 979 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); |
980 sync_manager_.OnInvalidatorStateChange(state); | 980 sync_manager_.OnInvalidatorStateChange(state); |
981 } | 981 } |
982 | 982 |
983 void TriggerOnIncomingNotificationForTest(ModelTypeSet model_types) { | 983 void TriggerOnIncomingNotificationForTest(ModelTypeSet model_types) { |
984 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); | 984 DCHECK(sync_manager_.thread_checker_.CalledOnValidThread()); |
985 ModelTypeInvalidationMap invalidation_map = | 985 ObjectIdSet id_set = ModelTypeSetToObjectIdSet(model_types); |
986 ModelTypeSetToInvalidationMap(model_types, std::string()); | 986 ObjectIdInvalidationMap invalidation_map = |
987 sync_manager_.OnIncomingInvalidation( | 987 ObjectIdSetToInvalidationMap(id_set, |
988 ModelTypeInvalidationMapToObjectIdInvalidationMap( | 988 Invalidation::kUnknownVersion, |
989 invalidation_map)); | 989 std::string()); |
| 990 sync_manager_.OnIncomingInvalidation(invalidation_map); |
990 } | 991 } |
991 | 992 |
992 void SetProgressMarkerForType(ModelType type, bool set) { | 993 void SetProgressMarkerForType(ModelType type, bool set) { |
993 if (set) { | 994 if (set) { |
994 sync_pb::DataTypeProgressMarker marker; | 995 sync_pb::DataTypeProgressMarker marker; |
995 marker.set_token("token"); | 996 marker.set_token("token"); |
996 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); | 997 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); |
997 sync_manager_.directory()->SetDownloadProgress(type, marker); | 998 sync_manager_.directory()->SetDownloadProgress(type, marker); |
998 } else { | 999 } else { |
999 sync_pb::DataTypeProgressMarker marker; | 1000 sync_pb::DataTypeProgressMarker marker; |
(...skipping 2507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3507 size_t folder_b_pos = | 3508 size_t folder_b_pos = |
3508 FindChangeInList(folder_b_id, ChangeRecord::ACTION_DELETE); | 3509 FindChangeInList(folder_b_id, ChangeRecord::ACTION_DELETE); |
3509 size_t child_pos = FindChangeInList(child_id, ChangeRecord::ACTION_DELETE); | 3510 size_t child_pos = FindChangeInList(child_id, ChangeRecord::ACTION_DELETE); |
3510 | 3511 |
3511 // Deletes should appear before updates. | 3512 // Deletes should appear before updates. |
3512 EXPECT_LT(child_pos, folder_a_pos); | 3513 EXPECT_LT(child_pos, folder_a_pos); |
3513 EXPECT_LT(folder_b_pos, folder_a_pos); | 3514 EXPECT_LT(folder_b_pos, folder_a_pos); |
3514 } | 3515 } |
3515 | 3516 |
3516 } // namespace | 3517 } // namespace |
OLD | NEW |