123456789101112131415161718192021222324252627282930313233343536 |
- // 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 "butil/synchronization/cancellation_flag.h"
- #include "butil/logging.h"
- #include "butil/synchronization/spin_wait.h"
- #include "butil/time/time.h"
- #include <gtest/gtest.h>
- namespace butil {
- namespace {
- 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());
- }
- } // namespace
- } // namespace butil
|