Chromium Code Reviews| 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, Invalidation::kUnknownVersion, ""); |
|
tim (not reviewing)
2013/08/28 00:13:00
Prefer std::string() to "". It's more explicit, th
rlarocque
2013/08/28 01:00:35
Done.
| |
| 988 ModelTypeInvalidationMapToObjectIdInvalidationMap( | 988 sync_manager_.OnIncomingInvalidation(invalidation_map); |
| 989 invalidation_map)); | |
| 990 } | 989 } |
| 991 | 990 |
| 992 void SetProgressMarkerForType(ModelType type, bool set) { | 991 void SetProgressMarkerForType(ModelType type, bool set) { |
| 993 if (set) { | 992 if (set) { |
| 994 sync_pb::DataTypeProgressMarker marker; | 993 sync_pb::DataTypeProgressMarker marker; |
| 995 marker.set_token("token"); | 994 marker.set_token("token"); |
| 996 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); | 995 marker.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); |
| 997 sync_manager_.directory()->SetDownloadProgress(type, marker); | 996 sync_manager_.directory()->SetDownloadProgress(type, marker); |
| 998 } else { | 997 } else { |
| 999 sync_pb::DataTypeProgressMarker marker; | 998 sync_pb::DataTypeProgressMarker marker; |
| (...skipping 2507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3507 size_t folder_b_pos = | 3506 size_t folder_b_pos = |
| 3508 FindChangeInList(folder_b_id, ChangeRecord::ACTION_DELETE); | 3507 FindChangeInList(folder_b_id, ChangeRecord::ACTION_DELETE); |
| 3509 size_t child_pos = FindChangeInList(child_id, ChangeRecord::ACTION_DELETE); | 3508 size_t child_pos = FindChangeInList(child_id, ChangeRecord::ACTION_DELETE); |
| 3510 | 3509 |
| 3511 // Deletes should appear before updates. | 3510 // Deletes should appear before updates. |
| 3512 EXPECT_LT(child_pos, folder_a_pos); | 3511 EXPECT_LT(child_pos, folder_a_pos); |
| 3513 EXPECT_LT(folder_b_pos, folder_a_pos); | 3512 EXPECT_LT(folder_b_pos, folder_a_pos); |
| 3514 } | 3513 } |
| 3515 | 3514 |
| 3516 } // namespace | 3515 } // namespace |
| OLD | NEW |