| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 void QuitLoopNow() { | 69 void QuitLoopNow() { |
| 70 // We use QuitNow() instead of Quit() as the latter may get stalled | 70 // We use QuitNow() instead of Quit() as the latter may get stalled |
| 71 // indefinitely in the presence of repeated timers with low delays | 71 // indefinitely in the presence of repeated timers with low delays |
| 72 // and a slow test (e.g., ThrottlingDoesThrottle [which has a poll | 72 // and a slow test (e.g., ThrottlingDoesThrottle [which has a poll |
| 73 // delay of 5ms] run under TSAN on the trybots). | 73 // delay of 5ms] run under TSAN on the trybots). |
| 74 base::MessageLoop::current()->QuitNow(); | 74 base::MessageLoop::current()->QuitNow(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void RunLoop() { | 77 void RunLoop() { |
| 78 base::MessageLoop::current()->Run(); | 78 base::RunLoop().Run(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void PumpLoop() { | 81 void PumpLoop() { |
| 82 // Do it this way instead of RunAllPending to pump loop exactly once | 82 // Do it this way instead of RunAllPending to pump loop exactly once |
| 83 // (necessary in the presence of timers; see comment in | 83 // (necessary in the presence of timers; see comment in |
| 84 // QuitLoopNow). | 84 // QuitLoopNow). |
| 85 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 85 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 86 base::Bind(&QuitLoopNow)); | 86 base::Bind(&QuitLoopNow)); |
| 87 RunLoop(); | 87 RunLoop(); |
| 88 } | 88 } |
| (...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 ASSERT_TRUE(scheduler()->IsBackingOff()); | 1470 ASSERT_TRUE(scheduler()->IsBackingOff()); |
| 1471 | 1471 |
| 1472 // Now succeed. | 1472 // Now succeed. |
| 1473 connection()->SetServerReachable(); | 1473 connection()->SetServerReachable(); |
| 1474 PumpLoopFor(2 * delta); | 1474 PumpLoopFor(2 * delta); |
| 1475 ASSERT_EQ(1, success_counter.times_called()); | 1475 ASSERT_EQ(1, success_counter.times_called()); |
| 1476 ASSERT_FALSE(scheduler()->IsBackingOff()); | 1476 ASSERT_FALSE(scheduler()->IsBackingOff()); |
| 1477 } | 1477 } |
| 1478 | 1478 |
| 1479 } // namespace syncer | 1479 } // namespace syncer |
| OLD | NEW |