| OLD | NEW | 
|---|
| 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/threading/thread_collision_warner.h" | 
|  | 6 | 
|  | 7 #include <memory> | 
|  | 8 | 
| 5 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" | 
| 6 #include "base/macros.h" | 10 #include "base/macros.h" | 
| 7 #include "base/memory/scoped_ptr.h" |  | 
| 8 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" | 
| 9 #include "base/threading/platform_thread.h" | 12 #include "base/threading/platform_thread.h" | 
| 10 #include "base/threading/simple_thread.h" | 13 #include "base/threading/simple_thread.h" | 
| 11 #include "base/threading/thread_collision_warner.h" |  | 
| 12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" | 
| 13 | 15 | 
| 14 // '' : local class member function does not have a body | 16 // '' : local class member function does not have a body | 
| 15 MSVC_PUSH_DISABLE_WARNING(4822) | 17 MSVC_PUSH_DISABLE_WARNING(4822) | 
| 16 | 18 | 
| 17 | 19 | 
| 18 #if defined(NDEBUG) | 20 #if defined(NDEBUG) | 
| 19 | 21 | 
| 20 // Would cause a memory leak otherwise. | 22 // Would cause a memory leak otherwise. | 
| 21 #undef DFAKE_MUTEX | 23 #undef DFAKE_MUTEX | 
| 22 #define DFAKE_MUTEX(obj) scoped_ptr<base::AsserterBase> obj | 24 #define DFAKE_MUTEX(obj) std::unique_ptr<base::AsserterBase> obj | 
| 23 | 25 | 
| 24 // In Release, we expect the AsserterBase::warn() to not happen. | 26 // In Release, we expect the AsserterBase::warn() to not happen. | 
| 25 #define EXPECT_NDEBUG_FALSE_DEBUG_TRUE EXPECT_FALSE | 27 #define EXPECT_NDEBUG_FALSE_DEBUG_TRUE EXPECT_FALSE | 
| 26 | 28 | 
| 27 #else | 29 #else | 
| 28 | 30 | 
| 29 // In Debug, we expect the AsserterBase::warn() to happen. | 31 // In Debug, we expect the AsserterBase::warn() to happen. | 
| 30 #define EXPECT_NDEBUG_FALSE_DEBUG_TRUE EXPECT_TRUE | 32 #define EXPECT_NDEBUG_FALSE_DEBUG_TRUE EXPECT_TRUE | 
| 31 | 33 | 
| 32 #endif | 34 #endif | 
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 371   base::DelegateSimpleThread thread_b(&queue_user_b, "queue_user_thread_b"); | 373   base::DelegateSimpleThread thread_b(&queue_user_b, "queue_user_thread_b"); | 
| 372 | 374 | 
| 373   thread_a.Start(); | 375   thread_a.Start(); | 
| 374   thread_b.Start(); | 376   thread_b.Start(); | 
| 375 | 377 | 
| 376   thread_a.Join(); | 378   thread_a.Join(); | 
| 377   thread_b.Join(); | 379   thread_b.Join(); | 
| 378 | 380 | 
| 379   EXPECT_FALSE(local_reporter->fail_state()); | 381   EXPECT_FALSE(local_reporter->fail_state()); | 
| 380 } | 382 } | 
| OLD | NEW | 
|---|