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 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ObjectIdSet id_set = ModelTypeSetToObjectIdSet(model_types); | 985 ObjectIdSet id_set = ModelTypeSetToObjectIdSet(model_types); |
986 ObjectIdInvalidationMap invalidation_map = | 986 ObjectIdInvalidationMap invalidation_map = |
987 ObjectIdSetToInvalidationMap(id_set, | 987 ObjectIdInvalidationMap::InvalidateAll(id_set); |
988 Invalidation::kUnknownVersion, | |
989 std::string()); | |
990 sync_manager_.OnIncomingInvalidation(invalidation_map); | 988 sync_manager_.OnIncomingInvalidation(invalidation_map); |
991 } | 989 } |
992 | 990 |
993 void SetProgressMarkerForType(ModelType type, bool set) { | 991 void SetProgressMarkerForType(ModelType type, bool set) { |
994 if (set) { | 992 if (set) { |
995 sync_pb::DataTypeProgressMarker marker; | 993 sync_pb::DataTypeProgressMarker marker; |
996 marker.set_token("token"); | 994 marker.set_token("token"); |
997 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); | 995 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); |
998 sync_manager_.directory()->SetDownloadProgress(type, marker); | 996 sync_manager_.directory()->SetDownloadProgress(type, marker); |
999 } else { | 997 } else { |
(...skipping 2508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3508 size_t folder_b_pos = | 3506 size_t folder_b_pos = |
3509 FindChangeInList(folder_b_id, ChangeRecord::ACTION_DELETE); | 3507 FindChangeInList(folder_b_id, ChangeRecord::ACTION_DELETE); |
3510 size_t child_pos = FindChangeInList(child_id, ChangeRecord::ACTION_DELETE); | 3508 size_t child_pos = FindChangeInList(child_id, ChangeRecord::ACTION_DELETE); |
3511 | 3509 |
3512 // Deletes should appear before updates. | 3510 // Deletes should appear before updates. |
3513 EXPECT_LT(child_pos, folder_a_pos); | 3511 EXPECT_LT(child_pos, folder_a_pos); |
3514 EXPECT_LT(folder_b_pos, folder_a_pos); | 3512 EXPECT_LT(folder_b_pos, folder_a_pos); |
3515 } | 3513 } |
3516 | 3514 |
3517 } // namespace | 3515 } // namespace |
OLD | NEW |