chromium/sandbox/linux/services/thread_helpers_unittest.cc

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

#include "sandbox/linux/services/thread_helpers.h"

#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

#include "base/check_op.h"
#include "base/posix/eintr_wrapper.h"
#include "base/process/process_metrics.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
#include "sandbox/linux/tests/unit_tests.h"
#include "testing/gtest/include/gtest/gtest.h"

PlatformThread;

namespace sandbox {

namespace {

// These tests fail under ThreadSanitizer, see http://crbug.com/342305
#if !defined(THREAD_SANITIZER)

const int kRaceTestIterations =;

class ScopedProc {};

TEST(ThreadHelpers, IsSingleThreadedBasic) {}

SANDBOX_TEST(ThreadHelpers, AssertSingleThreaded) {}

TEST(ThreadHelpers, IsSingleThreadedIterated) {}

TEST(ThreadHelpers, IsSingleThreadedStartAndStop) {}

SANDBOX_TEST(ThreadHelpers, AssertSingleThreadedAfterThreadStopped) {}

// Only run this test in Debug mode, where AssertSingleThreaded() will return
// in less than 64ms.
#if !defined(NDEBUG)
SANDBOX_DEATH_TEST(
    ThreadHelpers,
    AssertSingleThreadedDies,
    DEATH_MESSAGE(
        ThreadHelpers::GetAssertSingleThreadedErrorMessageForTests())) {}
#endif  // !defined(NDEBUG)

#endif  // !defined(THREAD_SANITIZER)

}  // namespace

}  // namespace sandbox