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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/time.h" | 6 #include "base/time.h" |
7 #include "sync/engine/backoff_delay_provider.h" | 7 #include "sync/engine/backoff_delay_provider.h" |
8 #include "sync/engine/sync_scheduler_impl.h" | 8 #include "sync/engine/sync_scheduler_impl.h" |
9 #include "sync/engine/throttled_data_type_tracker.h" | 9 #include "sync/engine/throttled_data_type_tracker.h" |
10 #include "sync/internal_api/public/engine/polling_constants.h" | 10 #include "sync/internal_api/public/engine/polling_constants.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 SyncSchedulerImpl::JobProcessDecision decision = | 137 SyncSchedulerImpl::JobProcessDecision decision = |
138 CreateAndDecideJob(SyncSchedulerImpl::SyncSessionJob::NUDGE); | 138 CreateAndDecideJob(SyncSchedulerImpl::SyncSessionJob::NUDGE); |
139 | 139 |
140 EXPECT_EQ(decision, SyncSchedulerImpl::SAVE); | 140 EXPECT_EQ(decision, SyncSchedulerImpl::SAVE); |
141 } | 141 } |
142 | 142 |
143 TEST_F(SyncSchedulerWhiteboxTest, SaveNudgeWhileTypeThrottled) { | 143 TEST_F(SyncSchedulerWhiteboxTest, SaveNudgeWhileTypeThrottled) { |
144 InitializeSyncerOnNormalMode(); | 144 InitializeSyncerOnNormalMode(); |
145 | 145 |
146 ModelTypeSet types; | 146 const ModelTypeSet types(BOOKMARKS); |
147 types.Put(BOOKMARKS); | |
148 | 147 |
149 // Mark bookmarks as throttled. | 148 // Mark bookmarks as throttled. |
150 context()->throttled_data_type_tracker()->SetUnthrottleTime( | 149 context()->throttled_data_type_tracker()->SetUnthrottleTime( |
151 types, base::TimeTicks::Now() + base::TimeDelta::FromHours(2)); | 150 types, base::TimeTicks::Now() + base::TimeDelta::FromHours(2)); |
152 | 151 |
153 ModelTypeStateMap type_state_map; | 152 const ModelTypeInvalidationMap& invalidation_map = |
154 type_state_map.insert(std::make_pair(BOOKMARKS, InvalidationState())); | 153 ModelTypeSetToInvalidationMap(types, std::string()); |
155 | 154 |
156 SyncSourceInfo info(GetUpdatesCallerInfo::LOCAL, type_state_map); | 155 SyncSourceInfo info(GetUpdatesCallerInfo::LOCAL, invalidation_map); |
157 SyncSession* s = scheduler_->CreateSyncSession(info); | 156 SyncSession* s = scheduler_->CreateSyncSession(info); |
158 | 157 |
159 // Now schedule a nudge with just bookmarks and the change is local. | 158 // Now schedule a nudge with just bookmarks and the change is local. |
160 SyncSchedulerImpl::SyncSessionJob job( | 159 SyncSchedulerImpl::SyncSessionJob job( |
161 SyncSchedulerImpl::SyncSessionJob::NUDGE, | 160 SyncSchedulerImpl::SyncSessionJob::NUDGE, |
162 TimeTicks::Now(), | 161 TimeTicks::Now(), |
163 make_linked_ptr(s), | 162 make_linked_ptr(s), |
164 false, | 163 false, |
165 ConfigurationParams(), | 164 ConfigurationParams(), |
166 FROM_HERE); | 165 FROM_HERE); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 struct SyncSchedulerImpl::SyncSessionJob job; | 261 struct SyncSchedulerImpl::SyncSessionJob job; |
263 job.purpose = SyncSchedulerImpl::SyncSessionJob::CONFIGURATION; | 262 job.purpose = SyncSchedulerImpl::SyncSessionJob::CONFIGURATION; |
264 job.scheduled_start = TimeTicks::Now(); | 263 job.scheduled_start = TimeTicks::Now(); |
265 job.is_canary_job = true; | 264 job.is_canary_job = true; |
266 SyncSchedulerImpl::JobProcessDecision decision = DecideOnJob(job); | 265 SyncSchedulerImpl::JobProcessDecision decision = DecideOnJob(job); |
267 | 266 |
268 EXPECT_EQ(decision, SyncSchedulerImpl::CONTINUE); | 267 EXPECT_EQ(decision, SyncSchedulerImpl::CONTINUE); |
269 } | 268 } |
270 | 269 |
271 } // namespace syncer | 270 } // namespace syncer |
OLD | NEW |