Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Side by Side Diff: sync/engine/sync_scheduler_unittest.cc

Issue 2086363002: Remove calls to deprecated MessageLoop methods in sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sync/internal_api/attachments/attachment_service_proxy_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | sync/internal_api/attachments/attachment_service_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698