Commit 74c9298f authored by kylechar's avatar kylechar Committed by Commit Bot

viz: Add OnFrameTokenUpdate test

CompositorFrameSinkSupportTest.OnFrameTokenUpdate covers the same
functionality as a now deleted HostFrameSinkManagerLocalTest.

Bug: 1033683
Change-Id: I4783febb64da93f2d77e4bd6e1d80665e09313b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2008060Reviewed-by: default avatarSean Gilhuly <sgilhuly@chromium.org>
Commit-Queue: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733051}
parent 6d729a9e
...@@ -45,6 +45,8 @@ constexpr FrameSinkId kAnotherArbitraryFrameSinkId(2, 2); ...@@ -45,6 +45,8 @@ constexpr FrameSinkId kAnotherArbitraryFrameSinkId(2, 2);
const base::UnguessableToken kArbitraryToken = const base::UnguessableToken kArbitraryToken =
base::UnguessableToken::Deserialize(1, 2); base::UnguessableToken::Deserialize(1, 2);
const base::UnguessableToken kAnotherArbitraryToken =
base::UnguessableToken::Deserialize(2, 2);
const base::UnguessableToken kArbitrarySourceId1 = const base::UnguessableToken kArbitrarySourceId1 =
base::UnguessableToken::Deserialize(0xdead, 0xbeef); base::UnguessableToken::Deserialize(0xdead, 0xbeef);
const base::UnguessableToken kArbitrarySourceId2 = const base::UnguessableToken kArbitrarySourceId2 =
...@@ -1170,6 +1172,37 @@ TEST_F(CompositorFrameSinkSupportTest, ...@@ -1170,6 +1172,37 @@ TEST_F(CompositorFrameSinkSupportTest,
support_->SubmitCompositorFrame(local_surface_id, std::move(frame)); support_->SubmitCompositorFrame(local_surface_id, std::move(frame));
} }
// Verify that FrameToken is sent to the client if and only if the frame is
// active.
TEST_F(CompositorFrameSinkSupportTest, OnFrameTokenUpdate) {
LocalSurfaceId child_local_surface_id(1, kAnotherArbitraryToken);
SurfaceId child_id(kAnotherArbitraryFrameSinkId, child_local_surface_id);
auto frame = CompositorFrameBuilder()
.AddDefaultRenderPass()
.SetSendFrameTokenToEmbedder(true)
.SetActivationDependencies({child_id})
.Build();
uint32_t frame_token = frame.metadata.frame_token;
ASSERT_NE(frame_token, 0u);
LocalSurfaceId local_surface_id(1, kArbitraryToken);
support_->SubmitCompositorFrame(local_surface_id, std::move(frame));
Surface* surface = support_->GetLastCreatedSurfaceForTesting();
EXPECT_TRUE(surface->has_deadline());
EXPECT_FALSE(surface->HasActiveFrame());
EXPECT_TRUE(surface->HasPendingFrame());
// Since the frame is not activated, |frame_token| is not sent to the client.
EXPECT_CALL(frame_sink_manager_client_, OnFrameTokenChanged(_, _)).Times(0);
testing::Mock::VerifyAndClearExpectations(&frame_sink_manager_client_);
// Since the frame is now activated, |frame_token| is sent to the client.
EXPECT_CALL(frame_sink_manager_client_, OnFrameTokenChanged(_, frame_token));
surface->ActivatePendingFrameForDeadline();
}
// This test verifies that it is not possible to reuse the same embed token in // This test verifies that it is not possible to reuse the same embed token in
// two different frame sinks. // two different frame sinks.
TEST_F(CompositorFrameSinkSupportTest, TEST_F(CompositorFrameSinkSupportTest,
......
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