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

Side by Side Diff: webrtc/base/thread_checker_unittest.cc

Issue 1345433002: Add RTC_ prefix to contructormagic macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Formatting fix. Created 5 years, 3 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
« no previous file with comments | « webrtc/base/thread.h ('k') | webrtc/base/virtualsocketserver.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 void DetachFromThread() { 44 void DetachFromThread() {
45 ThreadChecker::DetachFromThread(); 45 ThreadChecker::DetachFromThread();
46 } 46 }
47 47
48 static void MethodOnDifferentThreadImpl(); 48 static void MethodOnDifferentThreadImpl();
49 static void DetachThenCallFromDifferentThreadImpl(); 49 static void DetachThenCallFromDifferentThreadImpl();
50 50
51 private: 51 private:
52 DISALLOW_COPY_AND_ASSIGN(ThreadCheckerClass); 52 RTC_DISALLOW_COPY_AND_ASSIGN(ThreadCheckerClass);
53 }; 53 };
54 54
55 // Calls ThreadCheckerClass::DoStuff on another thread. 55 // Calls ThreadCheckerClass::DoStuff on another thread.
56 class CallDoStuffOnThread : public Thread { 56 class CallDoStuffOnThread : public Thread {
57 public: 57 public:
58 explicit CallDoStuffOnThread(ThreadCheckerClass* thread_checker_class) 58 explicit CallDoStuffOnThread(ThreadCheckerClass* thread_checker_class)
59 : Thread(), 59 : Thread(),
60 thread_checker_class_(thread_checker_class) { 60 thread_checker_class_(thread_checker_class) {
61 SetName("call_do_stuff_on_thread", NULL); 61 SetName("call_do_stuff_on_thread", NULL);
62 } 62 }
63 63
64 void Run() override { thread_checker_class_->DoStuff(); } 64 void Run() override { thread_checker_class_->DoStuff(); }
65 65
66 // New method. Needed since Thread::Join is protected, and it is called by 66 // New method. Needed since Thread::Join is protected, and it is called by
67 // the TEST. 67 // the TEST.
68 void Join() { 68 void Join() {
69 Thread::Join(); 69 Thread::Join();
70 } 70 }
71 71
72 private: 72 private:
73 ThreadCheckerClass* thread_checker_class_; 73 ThreadCheckerClass* thread_checker_class_;
74 74
75 DISALLOW_COPY_AND_ASSIGN(CallDoStuffOnThread); 75 RTC_DISALLOW_COPY_AND_ASSIGN(CallDoStuffOnThread);
76 }; 76 };
77 77
78 // Deletes ThreadCheckerClass on a different thread. 78 // Deletes ThreadCheckerClass on a different thread.
79 class DeleteThreadCheckerClassOnThread : public Thread { 79 class DeleteThreadCheckerClassOnThread : public Thread {
80 public: 80 public:
81 explicit DeleteThreadCheckerClassOnThread( 81 explicit DeleteThreadCheckerClassOnThread(
82 ThreadCheckerClass* thread_checker_class) 82 ThreadCheckerClass* thread_checker_class)
83 : Thread(), 83 : Thread(),
84 thread_checker_class_(thread_checker_class) { 84 thread_checker_class_(thread_checker_class) {
85 SetName("delete_thread_checker_class_on_thread", NULL); 85 SetName("delete_thread_checker_class_on_thread", NULL);
86 } 86 }
87 87
88 void Run() override { thread_checker_class_.reset(); } 88 void Run() override { thread_checker_class_.reset(); }
89 89
90 // New method. Needed since Thread::Join is protected, and it is called by 90 // New method. Needed since Thread::Join is protected, and it is called by
91 // the TEST. 91 // the TEST.
92 void Join() { 92 void Join() {
93 Thread::Join(); 93 Thread::Join();
94 } 94 }
95 95
96 private: 96 private:
97 scoped_ptr<ThreadCheckerClass> thread_checker_class_; 97 scoped_ptr<ThreadCheckerClass> thread_checker_class_;
98 98
99 DISALLOW_COPY_AND_ASSIGN(DeleteThreadCheckerClassOnThread); 99 RTC_DISALLOW_COPY_AND_ASSIGN(DeleteThreadCheckerClassOnThread);
100 }; 100 };
101 101
102 } // namespace 102 } // namespace
103 103
104 TEST(ThreadCheckerTest, CallsAllowedOnSameThread) { 104 TEST(ThreadCheckerTest, CallsAllowedOnSameThread) {
105 scoped_ptr<ThreadCheckerClass> thread_checker_class( 105 scoped_ptr<ThreadCheckerClass> thread_checker_class(
106 new ThreadCheckerClass); 106 new ThreadCheckerClass);
107 107
108 // Verify that DoStuff doesn't assert. 108 // Verify that DoStuff doesn't assert.
109 thread_checker_class->DoStuff(); 109 thread_checker_class->DoStuff();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl(); 192 ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl();
193 } 193 }
194 #endif // ENABLE_THREAD_CHECKER 194 #endif // ENABLE_THREAD_CHECKER
195 195
196 #endif // GTEST_HAS_DEATH_TEST || !ENABLE_THREAD_CHECKER 196 #endif // GTEST_HAS_DEATH_TEST || !ENABLE_THREAD_CHECKER
197 197
198 // Just in case we ever get lumped together with other compilation units. 198 // Just in case we ever get lumped together with other compilation units.
199 #undef ENABLE_THREAD_CHECKER 199 #undef ENABLE_THREAD_CHECKER
200 200
201 } // namespace rtc 201 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/thread.h ('k') | webrtc/base/virtualsocketserver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698