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

Side by Side Diff: base/threading/non_thread_safe_unittest.cc

Issue 10004001: Add virtual and OVERRIDE to base/ implementation files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win Fix -> Missing header Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « base/test/test_suite.cc ('k') | base/threading/sequenced_worker_pool_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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/non_thread_safe.h" 8 #include "base/threading/non_thread_safe.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 24 matching lines...) Expand all
35 }; 35 };
36 36
37 // Calls NonThreadSafeClass::DoStuff on another thread. 37 // Calls NonThreadSafeClass::DoStuff on another thread.
38 class CallDoStuffOnThread : public SimpleThread { 38 class CallDoStuffOnThread : public SimpleThread {
39 public: 39 public:
40 CallDoStuffOnThread(NonThreadSafeClass* non_thread_safe_class) 40 CallDoStuffOnThread(NonThreadSafeClass* non_thread_safe_class)
41 : SimpleThread("call_do_stuff_on_thread"), 41 : SimpleThread("call_do_stuff_on_thread"),
42 non_thread_safe_class_(non_thread_safe_class) { 42 non_thread_safe_class_(non_thread_safe_class) {
43 } 43 }
44 44
45 virtual void Run() { 45 virtual void Run() OVERRIDE {
46 non_thread_safe_class_->DoStuff(); 46 non_thread_safe_class_->DoStuff();
47 } 47 }
48 48
49 private: 49 private:
50 NonThreadSafeClass* non_thread_safe_class_; 50 NonThreadSafeClass* non_thread_safe_class_;
51 51
52 DISALLOW_COPY_AND_ASSIGN(CallDoStuffOnThread); 52 DISALLOW_COPY_AND_ASSIGN(CallDoStuffOnThread);
53 }; 53 };
54 54
55 // Deletes NonThreadSafeClass on a different thread. 55 // Deletes NonThreadSafeClass on a different thread.
56 class DeleteNonThreadSafeClassOnThread : public SimpleThread { 56 class DeleteNonThreadSafeClassOnThread : public SimpleThread {
57 public: 57 public:
58 DeleteNonThreadSafeClassOnThread(NonThreadSafeClass* non_thread_safe_class) 58 DeleteNonThreadSafeClassOnThread(NonThreadSafeClass* non_thread_safe_class)
59 : SimpleThread("delete_non_thread_safe_class_on_thread"), 59 : SimpleThread("delete_non_thread_safe_class_on_thread"),
60 non_thread_safe_class_(non_thread_safe_class) { 60 non_thread_safe_class_(non_thread_safe_class) {
61 } 61 }
62 62
63 virtual void Run() { 63 virtual void Run() OVERRIDE {
64 non_thread_safe_class_.reset(); 64 non_thread_safe_class_.reset();
65 } 65 }
66 66
67 private: 67 private:
68 scoped_ptr<NonThreadSafeClass> non_thread_safe_class_; 68 scoped_ptr<NonThreadSafeClass> non_thread_safe_class_;
69 69
70 DISALLOW_COPY_AND_ASSIGN(DeleteNonThreadSafeClassOnThread); 70 DISALLOW_COPY_AND_ASSIGN(DeleteNonThreadSafeClassOnThread);
71 }; 71 };
72 72
73 TEST(NonThreadSafeTest, CallsAllowedOnSameThread) { 73 TEST(NonThreadSafeTest, CallsAllowedOnSameThread) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 #else 143 #else
144 TEST(NonThreadSafeTest, DestructorAllowedOnDifferentThreadInRelease) { 144 TEST(NonThreadSafeTest, DestructorAllowedOnDifferentThreadInRelease) {
145 NonThreadSafeClass::DestructorOnDifferentThreadImpl(); 145 NonThreadSafeClass::DestructorOnDifferentThreadImpl();
146 } 146 }
147 #endif // NDEBUG 147 #endif // NDEBUG
148 148
149 #endif // GTEST_HAS_DEATH_TEST || NDEBUG 149 #endif // GTEST_HAS_DEATH_TEST || NDEBUG
150 150
151 } // namespace base 151 } // namespace base
OLDNEW
« no previous file with comments | « base/test/test_suite.cc ('k') | base/threading/sequenced_worker_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698