#include "base/scoped_multi_source_observation.h"
#include "base/containers/contains.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/scoped_observation_traits.h"
#include "base/test/gtest_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
namespace {
class TestSourceObserver { … };
class TestSource { … };
void TestSource::AddObserver(TestSourceObserver* observer) { … }
void TestSource::RemoveObserver(TestSourceObserver* observer) { … }
bool TestSource::HasObserver(TestSourceObserver* observer) const { … }
TestScopedMultiSourceObservation;
class ScopedMultiSourceObservationTest : public testing::Test { … };
}
TEST_F(ScopedMultiSourceObservationTest, RemovesSourcesOnDestruction) { … }
TEST_F(ScopedMultiSourceObservationTest, RemoveObservation) { … }
TEST_F(ScopedMultiSourceObservationTest, RemoveAllObservations) { … }
TEST_F(ScopedMultiSourceObservationTest, IsObservingSource) { … }
TEST_F(ScopedMultiSourceObservationTest, IsObservingAnySource) { … }
TEST_F(ScopedMultiSourceObservationTest, GetSourcesCount) { … }
namespace {
class TestSourceWithNonDefaultNames { … };
TestScopedMultiSourceObservationWithNonDefaultNames;
}
template <>
struct ScopedObservationTraits<TestSourceWithNonDefaultNames,
TestSourceObserver> { … };
TEST_F(ScopedMultiSourceObservationTest, NonDefaultNames) { … }
}