chromium/base/threading/simple_thread_unittest.cc

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

#include <memory>

#include "base/atomic_sequence_num.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/synchronization/waitable_event.h"
#include "base/test/gtest_util.h"
#include "base/threading/simple_thread.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace base {

namespace {

class SetIntRunner : public DelegateSimpleThread::Delegate {};

// Signals |started_| when Run() is invoked and waits until |released_| is
// signaled to return, signaling |done_| before doing so. Useful for tests that
// care to control Run()'s flow.
class ControlledRunner : public DelegateSimpleThread::Delegate {};

class WaitEventRunner : public DelegateSimpleThread::Delegate {};

class SeqRunner : public DelegateSimpleThread::Delegate {};

// We count up on a sequence number, firing on the event when we've hit our
// expected amount, otherwise we wait on the event.  This will ensure that we
// have all threads outstanding until we hit our expected thread pool size.
class VerifyPoolRunner : public DelegateSimpleThread::Delegate {};

}  // namespace

TEST(SimpleThreadTest, CreateAndJoin) {}

TEST(SimpleThreadTest, WaitForEvent) {}

TEST(SimpleThreadTest, NonJoinableStartAndDieOnJoin) {}

TEST(SimpleThreadTest, NonJoinableInactiveDelegateDestructionIsOkay) {}

TEST(SimpleThreadTest, ThreadPool) {}

}  // namespace base