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

Unified Diff: base/synchronization/cancellation_flag_unittest.cc

Issue 2163753004: Rename CancellationFlag to AtomicFlag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix dcheck death test 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
« no previous file with comments | « base/synchronization/cancellation_flag.cc ('k') | base/task_scheduler/task_scheduler_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/synchronization/cancellation_flag_unittest.cc
diff --git a/base/synchronization/cancellation_flag_unittest.cc b/base/synchronization/cancellation_flag_unittest.cc
deleted file mode 100644
index 13c74bcbd45ffa7b12703e93ab4c5065ccbff88b..0000000000000000000000000000000000000000
--- a/base/synchronization/cancellation_flag_unittest.cc
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Tests of CancellationFlag class.
-
-#include "base/synchronization/cancellation_flag.h"
-
-#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/threading/thread.h"
-#include "base/time/time.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "testing/platform_test.h"
-
-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());
- flag.Set();
- ASSERT_TRUE(flag.IsSet());
-}
-
-TEST(CancellationFlagTest, DoubleSetTest) {
- CancellationFlag flag;
- ASSERT_FALSE(flag.IsSet());
- flag.Set();
- ASSERT_TRUE(flag.IsSet());
- flag.Set();
- ASSERT_TRUE(flag.IsSet());
-}
-
-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
- // other thread.
- ::testing::FLAGS_gtest_death_test_style = "threadsafe";
- Thread t("CancellationFlagTest.SetOnDifferentThreadDeathTest");
- ASSERT_TRUE(t.Start());
- ASSERT_TRUE(t.message_loop());
- ASSERT_TRUE(t.IsRunning());
-
- CancellationFlag flag;
- t.task_runner()->PostTask(FROM_HERE, base::Bind(&CancelHelper, &flag));
-}
-
-} // namespace
-
-} // namespace base
« no previous file with comments | « base/synchronization/cancellation_flag.cc ('k') | base/task_scheduler/task_scheduler_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698