27 std::unique_ptr<MockSnapshotDelegate> snapshot_delegate;
30 snapshot_delegate = std::make_unique<MockSnapshotDelegate>();
32 ON_CALL(*snapshot_delegate, GetTextureRegistry())
34 ::testing::Return(snapshot_delegate->GetMockTextureRegistry()));
35 snapshot_delegate_weak_ptr = snapshot_delegate->GetWeakPtr();
40 snapshot_delegate_weak_ptr, task_runner);
43 PostTaskSync(task_runner, [&]() { snapshot_delegate.reset(); });
52 std::unique_ptr<MockSnapshotDelegate> snapshot_delegate;
55 snapshot_delegate = std::make_unique<MockSnapshotDelegate>();
57 ON_CALL(*snapshot_delegate, GetTextureRegistry())
59 ::testing::Return(snapshot_delegate->GetMockTextureRegistry()));
62 auto mock_texture = std::make_shared<impeller::testing::MockTexture>(desc);
63 EXPECT_CALL(*mock_texture, IsValid())
64 .WillRepeatedly(::testing::Return(
true));
67 MakeImpellerSnapshotSync(::testing::_, ::testing::_, ::testing::_))
68 .WillOnce(::testing::Return(mock_texture));
69 snapshot_delegate_weak_ptr = snapshot_delegate->GetWeakPtr();
72 sk_sp<DlDeferredImageGPUImpeller>
image;
75 task_runner->PostTask([&latch, &
image]() {
77 auto context = std::make_shared<impeller::testing::MockImpellerContext>();
78 EXPECT_EQ(
image->GetImpellerTexture(context),
nullptr);
83 snapshot_delegate_weak_ptr, task_runner);
89 auto context = std::make_shared<impeller::testing::MockImpellerContext>();
90 EXPECT_NE(
image->GetImpellerTexture(context),
nullptr);
91 snapshot_delegate.reset();
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...