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: base/threading/thread_checker_unittest.cc

Issue 614103004: replace 'virtual ... OVERRIDE' with '... override' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: process base/ Created 6 years, 2 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/threading/thread_checker.h" 8 #include "base/threading/thread_checker.h"
9 #include "base/threading/simple_thread.h" 9 #include "base/threading/simple_thread.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 }; 45 };
46 46
47 // Calls ThreadCheckerClass::DoStuff on another thread. 47 // Calls ThreadCheckerClass::DoStuff on another thread.
48 class CallDoStuffOnThread : public base::SimpleThread { 48 class CallDoStuffOnThread : public base::SimpleThread {
49 public: 49 public:
50 explicit CallDoStuffOnThread(ThreadCheckerClass* thread_checker_class) 50 explicit CallDoStuffOnThread(ThreadCheckerClass* thread_checker_class)
51 : SimpleThread("call_do_stuff_on_thread"), 51 : SimpleThread("call_do_stuff_on_thread"),
52 thread_checker_class_(thread_checker_class) { 52 thread_checker_class_(thread_checker_class) {
53 } 53 }
54 54
55 virtual void Run() OVERRIDE { 55 void Run() override { thread_checker_class_->DoStuff(); }
56 thread_checker_class_->DoStuff();
57 }
58 56
59 private: 57 private:
60 ThreadCheckerClass* thread_checker_class_; 58 ThreadCheckerClass* thread_checker_class_;
61 59
62 DISALLOW_COPY_AND_ASSIGN(CallDoStuffOnThread); 60 DISALLOW_COPY_AND_ASSIGN(CallDoStuffOnThread);
63 }; 61 };
64 62
65 // Deletes ThreadCheckerClass on a different thread. 63 // Deletes ThreadCheckerClass on a different thread.
66 class DeleteThreadCheckerClassOnThread : public base::SimpleThread { 64 class DeleteThreadCheckerClassOnThread : public base::SimpleThread {
67 public: 65 public:
68 explicit DeleteThreadCheckerClassOnThread( 66 explicit DeleteThreadCheckerClassOnThread(
69 ThreadCheckerClass* thread_checker_class) 67 ThreadCheckerClass* thread_checker_class)
70 : SimpleThread("delete_thread_checker_class_on_thread"), 68 : SimpleThread("delete_thread_checker_class_on_thread"),
71 thread_checker_class_(thread_checker_class) { 69 thread_checker_class_(thread_checker_class) {
72 } 70 }
73 71
74 virtual void Run() OVERRIDE { 72 void Run() override { thread_checker_class_.reset(); }
75 thread_checker_class_.reset();
76 }
77 73
78 private: 74 private:
79 scoped_ptr<ThreadCheckerClass> thread_checker_class_; 75 scoped_ptr<ThreadCheckerClass> thread_checker_class_;
80 76
81 DISALLOW_COPY_AND_ASSIGN(DeleteThreadCheckerClassOnThread); 77 DISALLOW_COPY_AND_ASSIGN(DeleteThreadCheckerClassOnThread);
82 }; 78 };
83 79
84 } // namespace 80 } // namespace
85 81
86 TEST(ThreadCheckerTest, CallsAllowedOnSameThread) { 82 TEST(ThreadCheckerTest, CallsAllowedOnSameThread) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl(); 170 ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl();
175 } 171 }
176 #endif // ENABLE_THREAD_CHECKER 172 #endif // ENABLE_THREAD_CHECKER
177 173
178 #endif // GTEST_HAS_DEATH_TEST || !ENABLE_THREAD_CHECKER 174 #endif // GTEST_HAS_DEATH_TEST || !ENABLE_THREAD_CHECKER
179 175
180 // Just in case we ever get lumped together with other compilation units. 176 // Just in case we ever get lumped together with other compilation units.
181 #undef ENABLE_THREAD_CHECKER 177 #undef ENABLE_THREAD_CHECKER
182 178
183 } // namespace base 179 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698