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

Unified Diff: base/synchronization/cancellation_flag_unittest.cc

Issue 2162053006: Move EXPECT_DCHECK_DEATH from base/task_scheduler and use it in relevant base/ tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698