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 #include "components/sync/engine_impl/cycle/nudge_tracker.h" | 5 #include "components/sync/engine_impl/cycle/nudge_tracker.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 nudge_tracker_.RecordLocalChange(ModelTypeSet(SESSIONS))); | 785 nudge_tracker_.RecordLocalChange(ModelTypeSet(SESSIONS))); |
786 } | 786 } |
787 | 787 |
788 // Check that custom nudge delays can never result in a value shorter than the | 788 // Check that custom nudge delays can never result in a value shorter than the |
789 // minimum nudge delay. | 789 // minimum nudge delay. |
790 TEST_F(NudgeTrackerTest, NoTypesShorterThanDefault) { | 790 TEST_F(NudgeTrackerTest, NoTypesShorterThanDefault) { |
791 // Set delay to a known value. | 791 // Set delay to a known value. |
792 nudge_tracker_.SetDefaultNudgeDelay(base::TimeDelta::FromMilliseconds(500)); | 792 nudge_tracker_.SetDefaultNudgeDelay(base::TimeDelta::FromMilliseconds(500)); |
793 | 793 |
794 std::map<ModelType, base::TimeDelta> delay_map; | 794 std::map<ModelType, base::TimeDelta> delay_map; |
795 ModelTypeSet protocol_types = syncer::ProtocolTypes(); | 795 ModelTypeSet protocol_types = ProtocolTypes(); |
796 for (ModelTypeSet::Iterator iter = protocol_types.First(); iter.Good(); | 796 for (ModelTypeSet::Iterator iter = protocol_types.First(); iter.Good(); |
797 iter.Inc()) { | 797 iter.Inc()) { |
798 delay_map[iter.Get()] = base::TimeDelta(); | 798 delay_map[iter.Get()] = base::TimeDelta(); |
799 } | 799 } |
800 nudge_tracker_.OnReceivedCustomNudgeDelays(delay_map); | 800 nudge_tracker_.OnReceivedCustomNudgeDelays(delay_map); |
801 | 801 |
802 // All types should still have a nudge greater than or equal to the minimum. | 802 // All types should still have a nudge greater than or equal to the minimum. |
803 for (ModelTypeSet::Iterator iter = protocol_types.First(); iter.Good(); | 803 for (ModelTypeSet::Iterator iter = protocol_types.First(); iter.Good(); |
804 iter.Inc()) { | 804 iter.Inc()) { |
805 EXPECT_GE(nudge_tracker_.RecordLocalChange(ModelTypeSet(iter.Get())), | 805 EXPECT_GE(nudge_tracker_.RecordLocalChange(ModelTypeSet(iter.Get())), |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 EXPECT_TRUE(IsInvalidationAcknowledged(inv1_id)); | 958 EXPECT_TRUE(IsInvalidationAcknowledged(inv1_id)); |
959 EXPECT_TRUE(IsInvalidationAcknowledged(inv2_id)); | 959 EXPECT_TRUE(IsInvalidationAcknowledged(inv2_id)); |
960 EXPECT_TRUE(IsInvalidationAcknowledged(inv3_id)); | 960 EXPECT_TRUE(IsInvalidationAcknowledged(inv3_id)); |
961 EXPECT_TRUE(IsInvalidationAcknowledged(inv4_id)); | 961 EXPECT_TRUE(IsInvalidationAcknowledged(inv4_id)); |
962 EXPECT_TRUE(IsInvalidationAcknowledged(inv5_id)); | 962 EXPECT_TRUE(IsInvalidationAcknowledged(inv5_id)); |
963 | 963 |
964 EXPECT_TRUE(AllInvalidationsAccountedFor()); | 964 EXPECT_TRUE(AllInvalidationsAccountedFor()); |
965 } | 965 } |
966 | 966 |
967 } // namespace syncer | 967 } // namespace syncer |
OLD | NEW |