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

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

Issue 10673010: Don't rely on undefined macro behaviour in unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 | « no previous file | no next file » | 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) 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"
11 11
12 // Duplicated from base/threading/thread_checker.h so that we can be 12 // Duplicated from base/threading/thread_checker.h so that we can be
13 // good citizens there and undef the macro. 13 // good citizens there and undef the macro.
14 #define ENABLE_THREAD_CHECKER (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) 14 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON))
jar (doing other things) 2012/06/26 23:02:40 nit: You don't need the outer parens
15 #define ENABLE_THREAD_CHECKER 1
16 #else
17 #define ENABLE_THREAD_CHECKER 0
18 #endif
15 19
16 namespace base { 20 namespace base {
17 21
18 // Simple class to exercise the basics of ThreadChecker. 22 // Simple class to exercise the basics of ThreadChecker.
19 // Both the destructor and DoStuff should verify that they were 23 // Both the destructor and DoStuff should verify that they were
20 // called on the same thread as the constructor. 24 // called on the same thread as the constructor.
21 class ThreadCheckerClass : public ThreadChecker { 25 class ThreadCheckerClass : public ThreadChecker {
22 public: 26 public:
23 ThreadCheckerClass() {} 27 ThreadCheckerClass() {}
24 28
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl(); 169 ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl();
166 } 170 }
167 #endif // ENABLE_THREAD_CHECKER 171 #endif // ENABLE_THREAD_CHECKER
168 172
169 #endif // GTEST_HAS_DEATH_TEST || !ENABLE_THREAD_CHECKER 173 #endif // GTEST_HAS_DEATH_TEST || !ENABLE_THREAD_CHECKER
170 174
171 // Just in case we ever get lumped together with other compilation units. 175 // Just in case we ever get lumped together with other compilation units.
172 #undef ENABLE_THREAD_CHECKER 176 #undef ENABLE_THREAD_CHECKER
173 177
174 } // namespace base 178 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698