#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 {
class BasicLockTestThread : public SimpleThread { … };
class BasicLockAcquireAndWaitThread : public SimpleThread { … };
}
TEST(CheckedLockTest, Basic) { … }
TEST(CheckedLockTest, AcquirePredecessor) { … }
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 { … };
}
TEST(CheckedLockTest, AnnotateAcquiredLockAlias) { … }
}
}