| 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/sync_scheduler.h" | 7 #include "sync/engine/sync_scheduler.h" |
| 8 #include "sync/engine/throttled_data_type_tracker.h" | 8 #include "sync/engine/throttled_data_type_tracker.h" |
| 9 #include "sync/sessions/sync_session_context.h" | 9 #include "sync/sessions/sync_session_context.h" |
| 10 #include "sync/sessions/test_util.h" | 10 #include "sync/sessions/test_util.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 SetMode(SyncScheduler::CONFIGURATION_MODE); | 221 SetMode(SyncScheduler::CONFIGURATION_MODE); |
| 222 | 222 |
| 223 SetWaitIntervalToThrottled(); | 223 SetWaitIntervalToThrottled(); |
| 224 | 224 |
| 225 SyncScheduler::JobProcessDecision decision = CreateAndDecideJob( | 225 SyncScheduler::JobProcessDecision decision = CreateAndDecideJob( |
| 226 SyncScheduler::SyncSessionJob::NUDGE); | 226 SyncScheduler::SyncSessionJob::NUDGE); |
| 227 | 227 |
| 228 EXPECT_EQ(decision, SyncScheduler::SAVE); | 228 EXPECT_EQ(decision, SyncScheduler::SAVE); |
| 229 } | 229 } |
| 230 | 230 |
| 231 TEST_F(SyncSchedulerWhiteboxTest, | |
| 232 ContinueClearUserDataUnderAllCircumstances) { | |
| 233 InitializeSyncerOnNormalMode(); | |
| 234 | |
| 235 SetMode(SyncScheduler::CONFIGURATION_MODE); | |
| 236 SetWaitIntervalToThrottled(); | |
| 237 SyncScheduler::JobProcessDecision decision = CreateAndDecideJob( | |
| 238 SyncScheduler::SyncSessionJob::CLEAR_USER_DATA); | |
| 239 EXPECT_EQ(decision, SyncScheduler::CONTINUE); | |
| 240 | |
| 241 SetMode(SyncScheduler::NORMAL_MODE); | |
| 242 SetWaitIntervalToExponentialBackoff(); | |
| 243 decision = CreateAndDecideJob( | |
| 244 SyncScheduler::SyncSessionJob::CLEAR_USER_DATA); | |
| 245 EXPECT_EQ(decision, SyncScheduler::CONTINUE); | |
| 246 } | |
| 247 | |
| 248 TEST_F(SyncSchedulerWhiteboxTest, ContinueNudgeWhileExponentialBackOff) { | 231 TEST_F(SyncSchedulerWhiteboxTest, ContinueNudgeWhileExponentialBackOff) { |
| 249 InitializeSyncerOnNormalMode(); | 232 InitializeSyncerOnNormalMode(); |
| 250 SetMode(SyncScheduler::NORMAL_MODE); | 233 SetMode(SyncScheduler::NORMAL_MODE); |
| 251 SetWaitIntervalToExponentialBackoff(); | 234 SetWaitIntervalToExponentialBackoff(); |
| 252 | 235 |
| 253 SyncScheduler::JobProcessDecision decision = CreateAndDecideJob( | 236 SyncScheduler::JobProcessDecision decision = CreateAndDecideJob( |
| 254 SyncScheduler::SyncSessionJob::NUDGE); | 237 SyncScheduler::SyncSessionJob::NUDGE); |
| 255 | 238 |
| 256 EXPECT_EQ(decision, SyncScheduler::CONTINUE); | 239 EXPECT_EQ(decision, SyncScheduler::CONTINUE); |
| 257 } | 240 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 276 struct SyncScheduler::SyncSessionJob job; | 259 struct SyncScheduler::SyncSessionJob job; |
| 277 job.purpose = SyncScheduler::SyncSessionJob::CONFIGURATION; | 260 job.purpose = SyncScheduler::SyncSessionJob::CONFIGURATION; |
| 278 job.scheduled_start = TimeTicks::Now(); | 261 job.scheduled_start = TimeTicks::Now(); |
| 279 job.is_canary_job = true; | 262 job.is_canary_job = true; |
| 280 SyncScheduler::JobProcessDecision decision = DecideOnJob(job); | 263 SyncScheduler::JobProcessDecision decision = DecideOnJob(job); |
| 281 | 264 |
| 282 EXPECT_EQ(decision, SyncScheduler::CONTINUE); | 265 EXPECT_EQ(decision, SyncScheduler::CONTINUE); |
| 283 } | 266 } |
| 284 | 267 |
| 285 } // namespace browser_sync | 268 } // namespace browser_sync |
| OLD | NEW |