Commit 36fdb49b authored by kylechar's avatar kylechar Committed by Commit Bot

Add test coverage for HostFrameSinkManager.

Bug: none
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel
Change-Id: I2d750279c9811ba931fd07630bdc401e6a98ee5c
Reviewed-on: https://chromium-review.googlesource.com/969070Reviewed-by: default avatarRia Jiang <riajiang@chromium.org>
Commit-Queue: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544388}
parent 3025c678
......@@ -30,14 +30,10 @@ class SingleThreadTaskRunner;
namespace viz {
namespace test {
class HostFrameSinkManagerTestBase;
} // namespace test
class CompositorFrameSinkSupport;
class FrameSinkManagerImpl;
class SurfaceInfo;
// Browser side wrapper of mojom::FrameSinkManager, to be used from the
// UI thread. Manages frame sinks and is intended to replace all usage of
// FrameSinkManagerImpl.
......@@ -158,7 +154,7 @@ class VIZ_HOST_EXPORT HostFrameSinkManager
uint32_t frame_token) override;
private:
friend class test::HostFrameSinkManagerTestBase;
friend class HostFrameSinkManagerTestBase;
struct FrameSinkData {
FrameSinkData();
......
......@@ -28,7 +28,6 @@
using testing::_;
namespace viz {
namespace test {
namespace {
constexpr FrameSinkId kFrameSinkParent1(1, 1);
......@@ -666,6 +665,28 @@ TEST_F(HostFrameSinkManagerRemoteTest, AssignTemporaryReference) {
run_loop.Run();
}
TEST_F(HostFrameSinkManagerRemoteTest, DropTemporaryReference) {
FakeHostFrameSinkClient host_client;
const SurfaceId surface_id = MakeSurfaceId(kFrameSinkChild1, 1);
host().RegisterFrameSinkId(surface_id.frame_sink_id(), &host_client);
MockCompositorFrameSinkClient compositor_frame_sink_client;
mojom::CompositorFrameSinkPtr compositor_frame_sink;
host().CreateCompositorFrameSink(
kFrameSinkChild1, MakeRequest(&compositor_frame_sink),
compositor_frame_sink_client.BindInterfacePtr());
// When HostFrameSinkManager gets OnSuraceCreated() it should find that
// kFrameSinkChild1 isn't embedded by anything and drop the temporary
// reference.
GetFrameSinkManagerClient()->OnSurfaceCreated(surface_id);
base::RunLoop run_loop;
EXPECT_CALL(impl(), DropTemporaryReference(surface_id))
.WillOnce(InvokeClosure(run_loop.QuitClosure()));
run_loop.Run();
}
// Verify that on lost context a RootCompositorFrameSink can be recreated.
TEST_F(HostFrameSinkManagerRemoteTest, ContextLossRecreateRoot) {
FakeHostFrameSinkClient host_client;
......@@ -724,5 +745,4 @@ TEST_F(HostFrameSinkManagerRemoteTest, ContextLossRecreateNonRoot) {
compositor_frame_sink2.FlushForTesting();
}
} // namespace test
} // namespace viz
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment