chromium/base/task/common/checked_lock_unittest.cc

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/task/common/checked_lock.h"

#include <stdlib.h>

#include "base/compiler_specific.h"
#include "base/memory/raw_ptr.h"
#include "base/rand_util.h"
#include "base/synchronization/waitable_event.h"
#include "base/test/gtest_util.h"
#include "base/threading/platform_thread.h"
#include "base/threading/simple_thread.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace base {
namespace internal {
namespace {

// Adapted from base::Lock's BasicLockTestThread to make sure
// Acquire()/Release() don't crash.
class BasicLockTestThread : public SimpleThread {};

class BasicLockAcquireAndWaitThread : public SimpleThread {};

}  // namespace

TEST(CheckedLockTest, Basic) {}

TEST(CheckedLockTest, AcquirePredecessor) {}

// Here and below, disable thread safety analysis, otherwise our death tests do
// not compile (the issues are caught at compile time).
TEST(CheckedLockTest, AcquirePredecessorWrongOrder)
NO_THREAD_SAFETY_ANALYSIS {}

TEST(CheckedLockTest, AcquireNonPredecessor) NO_THREAD_SAFETY_ANALYSIS {}

TEST(CheckedLockTest, AcquireMultipleLocksInOrder) {}

TEST(CheckedLockTest, AcquireMultipleLocksInTheMiddleOfAChain) {}

TEST(CheckedLockTest, AcquireMultipleLocksNoTransitivity)
NO_THREAD_SAFETY_ANALYSIS {}

TEST(CheckedLockTest, AcquireLocksDifferentThreadsSafely) {}

TEST(CheckedLockTest,
     AcquireLocksWithPredecessorDifferentThreadsSafelyPredecessorFirst) {}

TEST(CheckedLockTest,
     AcquireLocksWithPredecessorDifferentThreadsSafelyPredecessorLast) {}

TEST(CheckedLockTest,
     AcquireLocksWithPredecessorDifferentThreadsSafelyNoInterference) {}

TEST(CheckedLockTest, SelfReferentialLock) {}

TEST(CheckedLockTest, PredecessorCycle) {}

TEST(CheckedLockTest, PredecessorLongerCycle) {}

TEST(CheckedLockTest, AcquireLockAfterUniversalPredecessor) {}

TEST(CheckedLockTest, AcquireMultipleLocksAfterUniversalPredecessor)
NO_THREAD_SAFETY_ANALYSIS {}

TEST(CheckedLockTest, AcquireUniversalPredecessorAfterLock)
NO_THREAD_SAFETY_ANALYSIS {}

TEST(CheckedLockTest, AcquireUniversalPredecessorAfterUniversalPredecessor)
NO_THREAD_SAFETY_ANALYSIS {}

TEST(CheckedLockTest, AcquireLockBeforeUniversalSuccessor) {}

TEST(CheckedLockTest, AcquireMultipleLocksBeforeAndAfterUniversalSuccessor)
NO_THREAD_SAFETY_ANALYSIS {}

TEST(CheckedLockTest, AcquireUniversalSuccessorBeforeLock)
NO_THREAD_SAFETY_ANALYSIS {}

TEST(CheckedLockTest, AcquireUniversalSuccessorAfterUniversalSuccessor)
NO_THREAD_SAFETY_ANALYSIS {}

TEST(CheckedLockTest, UniversalSuccessorAsPredecessor)
NO_THREAD_SAFETY_ANALYSIS {}

TEST(CheckedLockTest, AssertNoLockHeldOnCurrentThread) {}

namespace {

class MemberGuardedByLock {};

}  // namespace

TEST(CheckedLockTest, AnnotateAcquiredLockAlias) {}

}  // namespace internal
}  // namespace base