| 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/sync_scheduler_impl.h" | 5 #include "components/sync/engine_impl/sync_scheduler_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 scoped_refptr<ExtensionsActivity> extensions_activity_; | 299 scoped_refptr<ExtensionsActivity> extensions_activity_; |
| 300 base::WeakPtrFactory<SyncSchedulerImplTest> weak_ptr_factory_; | 300 base::WeakPtrFactory<SyncSchedulerImplTest> weak_ptr_factory_; |
| 301 }; | 301 }; |
| 302 | 302 |
| 303 void RecordSyncShareImpl(SyncShareTimes* times) { | 303 void RecordSyncShareImpl(SyncShareTimes* times) { |
| 304 times->push_back(TimeTicks::Now()); | 304 times->push_back(TimeTicks::Now()); |
| 305 } | 305 } |
| 306 | 306 |
| 307 ACTION_P2(RecordSyncShare, times, success) { | 307 ACTION_P2(RecordSyncShare, times, success) { |
| 308 RecordSyncShareImpl(times); | 308 RecordSyncShareImpl(times); |
| 309 if (base::MessageLoop::current()->is_running()) | 309 if (base::RunLoop::IsRunningOnCurrentThread()) |
| 310 QuitLoopNow(); | 310 QuitLoopNow(); |
| 311 return success; | 311 return success; |
| 312 } | 312 } |
| 313 | 313 |
| 314 ACTION_P3(RecordSyncShareMultiple, times, quit_after, success) { | 314 ACTION_P3(RecordSyncShareMultiple, times, quit_after, success) { |
| 315 RecordSyncShareImpl(times); | 315 RecordSyncShareImpl(times); |
| 316 EXPECT_LE(times->size(), quit_after); | 316 EXPECT_LE(times->size(), quit_after); |
| 317 if (times->size() >= quit_after && | 317 if (times->size() >= quit_after && |
| 318 base::MessageLoop::current()->is_running()) { | 318 base::RunLoop::IsRunningOnCurrentThread()) { |
| 319 QuitLoopNow(); | 319 QuitLoopNow(); |
| 320 } | 320 } |
| 321 return success; | 321 return success; |
| 322 } | 322 } |
| 323 | 323 |
| 324 ACTION_P(StopScheduler, scheduler) { | 324 ACTION_P(StopScheduler, scheduler) { |
| 325 scheduler->Stop(); | 325 scheduler->Stop(); |
| 326 } | 326 } |
| 327 | 327 |
| 328 ACTION(AddFailureAndQuitLoopNow) { | 328 ACTION(AddFailureAndQuitLoopNow) { |
| (...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 | 1754 |
| 1755 // The Exponential backoff should be between previous backoff 1.5 and 2.5 | 1755 // The Exponential backoff should be between previous backoff 1.5 and 2.5 |
| 1756 // times. | 1756 // times. |
| 1757 EXPECT_LE(first_blocking_time * 1.5, second_blocking_time); | 1757 EXPECT_LE(first_blocking_time * 1.5, second_blocking_time); |
| 1758 EXPECT_GE(first_blocking_time * 2.5, second_blocking_time); | 1758 EXPECT_GE(first_blocking_time * 2.5, second_blocking_time); |
| 1759 | 1759 |
| 1760 StopSyncScheduler(); | 1760 StopSyncScheduler(); |
| 1761 } | 1761 } |
| 1762 | 1762 |
| 1763 } // namespace syncer | 1763 } // namespace syncer |
| OLD | NEW |