chromium/base/barrier_callback_unittest.cc

// Copyright 2021 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/barrier_callback.h"

#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/test/bind.h"
#include "base/test/gtest_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

TEST(BarrierCallbackTest, RunsImmediatelyForZeroCallbacks) {}

TEST(BarrierCallbackTest, ErrorToCallCallbackWithZeroCallbacks) {}

TEST(BarrierCallbackTest, RunAfterNumCallbacks) {}

TEST(BarrierCallbackTest, CopiesShareState) {}

template <typename... Args>
class DestructionIndicator {};

TEST(BarrierCallbackTest, ReleasesDoneCallbackWhenDone) {}

// Tests a case when `done_callback` resets the `barrier_callback`.
// `barrier_callback` is a RepeatingCallback holding the `done_callback`.
// `done_callback` holds a reference back to the `barrier_callback`. When
// `barrier_callback` is Run() it calls `done_callback` which erases the
// `barrier_callback` while still inside of its Run(). The Run() implementation
// (in base::BarrierCallback) must not try use itself after executing
// ResetBarrierCallback() or this test would crash inside Run().
TEST(BarrierCallbackTest, KeepingCallbackAliveUntilDone) {}

TEST(BarrierCallbackTest, SupportsMoveonlyTypes) {}

TEST(BarrierCallbackTest, SupportsConstRefResults) {}

TEST(BarrierCallbackTest, SupportsReferenceTypes) {}

}  // namespace