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