chromium/base/memory/singleton_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 <stdint.h>

#include "base/at_exit.h"
#include "base/memory/aligned_memory.h"
#include "base/memory/singleton.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace base {
namespace {

static_assert;

CallbackFunc;

template <size_t alignment>
class AlignedData {};

class IntSingleton {};

class Init5Singleton {};

struct Init5Singleton::Trait : public DefaultSingletonTraits<Init5Singleton> {};

int* SingletonInt() {}

int* SingletonInt5() {}

template <typename Type>
struct CallbackTrait : public DefaultSingletonTraits<Type> {};

class CallbackSingleton {};

class CallbackSingletonWithNoLeakTrait : public CallbackSingleton {};

class CallbackSingletonWithLeakTrait : public CallbackSingleton {};

class CallbackSingletonWithStaticTrait : public CallbackSingleton {};

struct CallbackSingletonWithStaticTrait::Trait
    : public StaticMemorySingletonTraits<CallbackSingletonWithStaticTrait> {};

template <class Type>
class AlignedTestSingleton {};


void SingletonNoLeak(CallbackFunc CallOnQuit) {}

void SingletonLeak(CallbackFunc CallOnQuit) {}

CallbackFunc* GetLeakySingleton() {}

void DeleteLeakySingleton() {}

void SingletonStatic(CallbackFunc CallOnQuit) {}

CallbackFunc* GetStaticSingleton() {}

class SingletonTest : public testing::Test {};

bool SingletonTest::non_leak_called_ =;
bool SingletonTest::leaky_called_ =;
bool SingletonTest::static_called_ =;

TEST_F(SingletonTest, Basic) {}

TEST_F(SingletonTest, Alignment) {}

}  // namespace
}  // namespace base