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

Side by Side Diff: components/sync/engine_impl/sync_scheduler_impl_unittest.cc

Issue 2818533003: Make nesting/running states a RunLoop rather than a MessageLoop concept. (Closed)
Patch Set: still need to check MessageLoop::current() in Mojo's RunLoopNestingObserver::GetForThread() Created 3 years, 7 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
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 "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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 scoped_refptr<ExtensionsActivity> extensions_activity_; 303 scoped_refptr<ExtensionsActivity> extensions_activity_;
304 base::WeakPtrFactory<SyncSchedulerImplTest> weak_ptr_factory_; 304 base::WeakPtrFactory<SyncSchedulerImplTest> weak_ptr_factory_;
305 }; 305 };
306 306
307 void RecordSyncShareImpl(SyncShareTimes* times) { 307 void RecordSyncShareImpl(SyncShareTimes* times) {
308 times->push_back(TimeTicks::Now()); 308 times->push_back(TimeTicks::Now());
309 } 309 }
310 310
311 ACTION_P2(RecordSyncShare, times, success) { 311 ACTION_P2(RecordSyncShare, times, success) {
312 RecordSyncShareImpl(times); 312 RecordSyncShareImpl(times);
313 if (base::MessageLoop::current()->is_running()) 313 if (base::RunLoop::IsRunningOnCurrentThread())
314 QuitLoopNow(); 314 QuitLoopNow();
315 return success; 315 return success;
316 } 316 }
317 317
318 ACTION_P3(RecordSyncShareMultiple, times, quit_after, success) { 318 ACTION_P3(RecordSyncShareMultiple, times, quit_after, success) {
319 RecordSyncShareImpl(times); 319 RecordSyncShareImpl(times);
320 EXPECT_LE(times->size(), quit_after); 320 EXPECT_LE(times->size(), quit_after);
321 if (times->size() >= quit_after && 321 if (times->size() >= quit_after &&
322 base::MessageLoop::current()->is_running()) { 322 base::RunLoop::IsRunningOnCurrentThread()) {
323 QuitLoopNow(); 323 QuitLoopNow();
324 } 324 }
325 return success; 325 return success;
326 } 326 }
327 327
328 ACTION_P(StopScheduler, scheduler) { 328 ACTION_P(StopScheduler, scheduler) {
329 scheduler->Stop(); 329 scheduler->Stop();
330 } 330 }
331 331
332 ACTION(AddFailureAndQuitLoopNow) { 332 ACTION(AddFailureAndQuitLoopNow) {
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 EXPECT_TRUE(GetBackedOffTypes().HasAll(themes_types)); 1893 EXPECT_TRUE(GetBackedOffTypes().HasAll(themes_types));
1894 EXPECT_FALSE(GetBackedOffTypes().HasAll(typed_urls_types)); 1894 EXPECT_FALSE(GetBackedOffTypes().HasAll(typed_urls_types));
1895 EXPECT_TRUE(BlockTimerIsRunning()); 1895 EXPECT_TRUE(BlockTimerIsRunning());
1896 EXPECT_FALSE(scheduler()->IsBackingOff()); 1896 EXPECT_FALSE(scheduler()->IsBackingOff());
1897 EXPECT_FALSE(scheduler()->IsCurrentlyThrottled()); 1897 EXPECT_FALSE(scheduler()->IsCurrentlyThrottled());
1898 1898
1899 StopSyncScheduler(); 1899 StopSyncScheduler();
1900 } 1900 }
1901 1901
1902 } // namespace syncer 1902 } // namespace syncer
OLDNEW
« no previous file with comments | « components/omnibox/browser/autocomplete_provider_unittest.cc ('k') | content/browser/browser_main_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698