9 #include "fml/closure.h"
10 #include "fml/synchronization/waitable_event.h"
11 #include "gtest/gtest.h"
18 TEST(ResourceManagerVKTest, CreatesANewInstance) {
24 TEST(ResourceManagerVKTest, ReclaimMovesAResourceAndDestroysIt) {
27 auto waiter = fml::AutoResetWaitableEvent();
29 auto rattle = fml::ScopedCleanupClosure([&waiter]() { waiter.Signal(); });
32 EXPECT_FALSE(waiter.IsSignaledForTest());
36 manager, std::move(rattle));
43 TEST(ResourceManagerVKTest, TerminatesWhenOutOfScope) {
47 std::weak_ptr<ResourceManagerVK> manager;
55 EXPECT_EQ(manager.lock(),
nullptr);
58 TEST(ResourceManagerVKTest, IsThreadSafe) {
63 std::weak_ptr<ResourceManagerVK> manager;
69 struct MockResource {};
71 std::thread thread1([&manager]() {
75 std::thread thread2([&manager]() {
84 EXPECT_EQ(manager.lock(),
nullptr);
static std::shared_ptr< ResourceManagerVK > Create()
Creates a shared resource manager (a dedicated thread).
A unique handle to a resource which will be reclaimed by the specified resource manager.
TEST(AllocationSizeTest, CanCreateTypedAllocations)