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

Side by Side Diff: base/task/cancelable_task_tracker_unittest.cc

Issue 804533005: Standardize usage of virtual/override/final specifiers in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify Created 5 years, 12 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/task/cancelable_task_tracker.h" 5 #include "base/task/cancelable_task_tracker.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "base/test/test_simple_task_runner.h" 18 #include "base/test/test_simple_task_runner.h"
19 #include "base/threading/thread.h" 19 #include "base/threading/thread.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 21
22 namespace base { 22 namespace base {
23 23
24 namespace { 24 namespace {
25 25
26 class CancelableTaskTrackerTest : public testing::Test { 26 class CancelableTaskTrackerTest : public testing::Test {
27 protected: 27 protected:
28 virtual ~CancelableTaskTrackerTest() { RunCurrentLoopUntilIdle(); } 28 ~CancelableTaskTrackerTest() override { RunCurrentLoopUntilIdle(); }
29 29
30 void RunCurrentLoopUntilIdle() { 30 void RunCurrentLoopUntilIdle() {
31 RunLoop run_loop; 31 RunLoop run_loop;
32 run_loop.RunUntilIdle(); 32 run_loop.RunUntilIdle();
33 } 33 }
34 34
35 CancelableTaskTracker task_tracker_; 35 CancelableTaskTracker task_tracker_;
36 36
37 private: 37 private:
38 // Needed by CancelableTaskTracker methods. 38 // Needed by CancelableTaskTracker methods.
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // The death tests below make sure that calling task tracker member 339 // The death tests below make sure that calling task tracker member
340 // functions from a thread different from its owner thread DCHECKs in 340 // functions from a thread different from its owner thread DCHECKs in
341 // debug mode. 341 // debug mode.
342 342
343 class CancelableTaskTrackerDeathTest : public CancelableTaskTrackerTest { 343 class CancelableTaskTrackerDeathTest : public CancelableTaskTrackerTest {
344 protected: 344 protected:
345 CancelableTaskTrackerDeathTest() { 345 CancelableTaskTrackerDeathTest() {
346 // The default style "fast" does not support multi-threaded tests. 346 // The default style "fast" does not support multi-threaded tests.
347 ::testing::FLAGS_gtest_death_test_style = "threadsafe"; 347 ::testing::FLAGS_gtest_death_test_style = "threadsafe";
348 } 348 }
349
350 virtual ~CancelableTaskTrackerDeathTest() {}
351 }; 349 };
352 350
353 // Duplicated from base/threading/thread_checker.h so that we can be 351 // Duplicated from base/threading/thread_checker.h so that we can be
354 // good citizens there and undef the macro. 352 // good citizens there and undef the macro.
355 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) 353 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
356 #define ENABLE_THREAD_CHECKER 1 354 #define ENABLE_THREAD_CHECKER 1
357 #else 355 #else
358 #define ENABLE_THREAD_CHECKER 0 356 #define ENABLE_THREAD_CHECKER 0
359 #endif 357 #endif
360 358
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 bad_thread.message_loop_proxy()->PostTask( 424 bad_thread.message_loop_proxy()->PostTask(
427 FROM_HERE, 425 FROM_HERE,
428 Bind(&MaybeRunDeadlyTaskTrackerMemberFunction, 426 Bind(&MaybeRunDeadlyTaskTrackerMemberFunction,
429 Unretained(&task_tracker_), 427 Unretained(&task_tracker_),
430 Bind(&CancelableTaskTracker::TryCancelAll))); 428 Bind(&CancelableTaskTracker::TryCancelAll)));
431 429
432 test_task_runner->RunUntilIdle(); 430 test_task_runner->RunUntilIdle();
433 } 431 }
434 432
435 } // namespace base 433 } // namespace base
OLDNEW
« no previous file with comments | « base/system_monitor/system_monitor_unittest.cc ('k') | base/threading/sequenced_worker_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698