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

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: Created 6 years 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 349
350 virtual ~CancelableTaskTrackerDeathTest() {} 350 ~CancelableTaskTrackerDeathTest() override {}
Nico 2014/12/22 22:05:42 remove?
dcheng 2014/12/22 22:41:26 Done.
351 }; 351 };
352 352
353 // Duplicated from base/threading/thread_checker.h so that we can be 353 // Duplicated from base/threading/thread_checker.h so that we can be
354 // good citizens there and undef the macro. 354 // good citizens there and undef the macro.
355 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) 355 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
356 #define ENABLE_THREAD_CHECKER 1 356 #define ENABLE_THREAD_CHECKER 1
357 #else 357 #else
358 #define ENABLE_THREAD_CHECKER 0 358 #define ENABLE_THREAD_CHECKER 0
359 #endif 359 #endif
360 360
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 bad_thread.message_loop_proxy()->PostTask( 426 bad_thread.message_loop_proxy()->PostTask(
427 FROM_HERE, 427 FROM_HERE,
428 Bind(&MaybeRunDeadlyTaskTrackerMemberFunction, 428 Bind(&MaybeRunDeadlyTaskTrackerMemberFunction,
429 Unretained(&task_tracker_), 429 Unretained(&task_tracker_),
430 Bind(&CancelableTaskTracker::TryCancelAll))); 430 Bind(&CancelableTaskTracker::TryCancelAll)));
431 431
432 test_task_runner->RunUntilIdle(); 432 test_task_runner->RunUntilIdle();
433 } 433 }
434 434
435 } // namespace base 435 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698