Chromium Code Reviews| Index: base/synchronization/cancellation_flag_unittest.cc |
| diff --git a/base/synchronization/cancellation_flag_unittest.cc b/base/synchronization/cancellation_flag_unittest.cc |
| index 13c74bcbd45ffa7b12703e93ab4c5065ccbff88b..db9c4132802eb8f2628ad10ca8a6f2544fed7ef3 100644 |
| --- a/base/synchronization/cancellation_flag_unittest.cc |
| +++ b/base/synchronization/cancellation_flag_unittest.cc |
| @@ -8,9 +8,9 @@ |
| #include "base/bind.h" |
| #include "base/location.h" |
| -#include "base/logging.h" |
| #include "base/single_thread_task_runner.h" |
| #include "base/synchronization/spin_wait.h" |
| +#include "base/test/gtest_util.h" |
| #include "base/threading/thread.h" |
| #include "base/time/time.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -18,18 +18,6 @@ |
| namespace base { |
| -namespace { |
| - |
| -//------------------------------------------------------------------------------ |
| -// Define our test class. |
| -//------------------------------------------------------------------------------ |
| - |
| -void CancelHelper(CancellationFlag* flag) { |
| -#if GTEST_HAS_DEATH_TEST |
| - ASSERT_DEBUG_DEATH(flag->Set(), ""); |
| -#endif |
| -} |
| - |
| TEST(CancellationFlagTest, SimpleSingleThreadedTest) { |
| CancellationFlag flag; |
| ASSERT_FALSE(flag.IsSet()); |
| @@ -46,6 +34,14 @@ TEST(CancellationFlagTest, DoubleSetTest) { |
| ASSERT_TRUE(flag.IsSet()); |
| } |
| +namespace { |
| + |
| +void CancelHelper(CancellationFlag* flag) { |
| + EXPECT_DCHECK_DEATH(flag->Set(), ""); |
| +} |
| + |
| +} // namespace |
| + |
| TEST(CancellationFlagTest, SetOnDifferentThreadDeathTest) { |
| // Checks that Set() can't be called from any other thread. |
| // CancellationFlag should die on a DCHECK if Set() is called from |
| @@ -60,6 +56,4 @@ TEST(CancellationFlagTest, SetOnDifferentThreadDeathTest) { |
| t.task_runner()->PostTask(FROM_HERE, base::Bind(&CancelHelper, &flag)); |
| } |
| -} // namespace |
|
danakj
2016/07/20 19:33:45
I think it is usual to wrap a unit test file an a
gab
2016/07/20 21:21:08
Done.
|
| - |
| } // namespace base |