Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Unified Diff: cc/surfaces/compositor_frame_sink_support_unittest.cc

Issue 2755463002: [cc] Fix CompositorFrameSinkSupport BeginFrameAck interface. (Closed)
Patch Set: pass on acks to MojoCFSs in clients. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/surfaces/compositor_frame_sink_support_unittest.cc
diff --git a/cc/surfaces/compositor_frame_sink_support_unittest.cc b/cc/surfaces/compositor_frame_sink_support_unittest.cc
index 28cb3448c1a1ce316f880ac07b32587d04f4d084..7f25af41eb466ee1f97ae57b2437c03f5cf50c76 100644
--- a/cc/surfaces/compositor_frame_sink_support_unittest.cc
+++ b/cc/surfaces/compositor_frame_sink_support_unittest.cc
@@ -71,9 +71,16 @@ SurfaceId MakeSurfaceId(const FrameSinkId& frame_sink_id, uint32_t local_id) {
LocalSurfaceId(local_id, base::UnguessableToken::Deserialize(0, 1u)));
}
+CompositorFrame MakeCompositorFrame() {
+ CompositorFrame compositor_frame;
+ compositor_frame.metadata.begin_frame_ack = BeginFrameAck(0, 1, 1, 0, true);
+ return compositor_frame;
+}
+
CompositorFrame MakeCompositorFrame(
std::vector<SurfaceId> referenced_surfaces) {
CompositorFrame compositor_frame;
+ compositor_frame.metadata.begin_frame_ack = BeginFrameAck(0, 1, 1, 0, true);
compositor_frame.metadata.referenced_surfaces =
std::move(referenced_surfaces);
return compositor_frame;
@@ -83,6 +90,7 @@ CompositorFrame MakeCompositorFrameWithResources(
std::vector<SurfaceId> referenced_surfaces,
TransferableResourceArray resource_list) {
CompositorFrame compositor_frame;
+ compositor_frame.metadata.begin_frame_ack = BeginFrameAck(0, 1, 1, 0, true);
compositor_frame.metadata.referenced_surfaces =
std::move(referenced_surfaces);
compositor_frame.resource_list = std::move(resource_list);
@@ -769,7 +777,7 @@ TEST_F(CompositorFrameSinkSupportTest,
ui::LatencyInfo info;
info.AddLatencyNumber(latency_type1, latency_id1, latency_sequence_number1);
- CompositorFrame frame;
+ CompositorFrame frame = MakeCompositorFrame();
frame.metadata.latency_info.push_back(info);
parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(),
@@ -786,7 +794,7 @@ TEST_F(CompositorFrameSinkSupportTest,
ui::LatencyInfo info2;
info2.AddLatencyNumber(latency_type2, latency_id2, latency_sequence_number2);
- CompositorFrame frame2;
+ CompositorFrame frame2 = MakeCompositorFrame();
frame2.metadata.latency_info.push_back(info2);
parent_support().SubmitCompositorFrame(parent_id2.local_surface_id(),
@@ -833,7 +841,7 @@ TEST_F(CompositorFrameSinkSupportTest,
ui::LatencyInfo info;
info.AddLatencyNumber(latency_type1, latency_id1, latency_sequence_number1);
- CompositorFrame frame;
+ CompositorFrame frame = MakeCompositorFrame();
frame.metadata.latency_info.push_back(info);
parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(),
@@ -857,7 +865,7 @@ TEST_F(CompositorFrameSinkSupportTest,
// Submit a frame with a new local surface id.
parent_support().SubmitCompositorFrame(parent_id2.local_surface_id(),
- CompositorFrame());
+ MakeCompositorFrame());
// Verify that the new surface has an active frame only.
Surface* surface = surface_manager().GetSurfaceForId(parent_id2);
@@ -901,7 +909,7 @@ TEST_F(CompositorFrameSinkSupportTest,
ui::LatencyInfo info;
info.AddLatencyNumber(latency_type1, latency_id1, latency_sequence_number1);
- CompositorFrame frame;
+ CompositorFrame frame = MakeCompositorFrame();
frame.metadata.latency_info.push_back(info);
parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(),
@@ -932,7 +940,7 @@ TEST_F(CompositorFrameSinkSupportTest,
// Resolve the dependencies. The frame in parent's surface must become active.
child_support1().SubmitCompositorFrame(child_id.local_surface_id(),
- CompositorFrame());
+ MakeCompositorFrame());
EXPECT_FALSE(surface->HasPendingFrame());
EXPECT_TRUE(surface->HasActiveFrame());
@@ -961,10 +969,14 @@ TEST_F(CompositorFrameSinkSupportTest, PassesOnBeginFrameAcks) {
CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1);
begin_frame_source()->TestOnBeginFrame(args);
- // Check that the support forwards our ack to the BeginFrameSource.
+ // Check that the support forwards a BeginFrameDidNotSwap ack to the
+ // BeginFrameSource.
BeginFrameAck ack(0, 1, 1, 0, false);
- display_support().DidFinishFrame(ack);
+ display_support().BeginFrameDidNotSwap(ack);
EXPECT_EQ(ack, begin_frame_source()->LastAckForObserver(&display_support()));
+
+ // TODO(eseckler): Check that the support forwards the BeginFrameAck attached
+ // to a CompositorFrame to the BeginFrameSource.
}
// Checks whether the resources are returned before we send an ack.
@@ -981,7 +993,7 @@ TEST_F(CompositorFrameSinkSupportTest, ReturnResourcesBeforeAck) {
EXPECT_CALL(support_client_, DidReceiveCompositorFrameAck());
}
parent_support().SubmitCompositorFrame(parent_id.local_surface_id(),
- CompositorFrame());
+ MakeCompositorFrame());
}
// Verifies that if a surface is marked destroyed and a new frame arrives for
@@ -997,7 +1009,7 @@ TEST_F(CompositorFrameSinkSupportTest, SurfaceResurrection) {
// Create the child surface by submitting a frame to it.
EXPECT_EQ(nullptr, surface_manager().GetSurfaceForId(child_id));
child_support1().SubmitCompositorFrame(child_id.local_surface_id(),
- CompositorFrame());
+ MakeCompositorFrame());
// Verify that the child surface is created.
Surface* surface = surface_manager().GetSurfaceForId(child_id);
@@ -1013,7 +1025,7 @@ TEST_F(CompositorFrameSinkSupportTest, SurfaceResurrection) {
// Child submits another frame to the same local surface id that is marked
// destroyed.
child_support1().SubmitCompositorFrame(child_id.local_surface_id(),
- CompositorFrame());
+ MakeCompositorFrame());
// Verify that the surface that was marked destroyed is recovered and is being
// used again.
@@ -1034,12 +1046,12 @@ TEST_F(CompositorFrameSinkSupportTest, LocalSurfaceIdIsReusable) {
// Submit the first frame. Creates the surface.
child_support1().SubmitCompositorFrame(child_id.local_surface_id(),
- CompositorFrame());
+ MakeCompositorFrame());
EXPECT_NE(nullptr, surface_manager().GetSurfaceForId(child_id));
// Remove the reference from parant. This allows us to destroy the surface.
parent_support().SubmitCompositorFrame(parent_id.local_surface_id(),
- CompositorFrame());
+ MakeCompositorFrame());
// Destroy the surface.
child_support1().EvictFrame();
@@ -1048,7 +1060,7 @@ TEST_F(CompositorFrameSinkSupportTest, LocalSurfaceIdIsReusable) {
// Submit another frame with the same local surface id. This should work fine
// and a new surface must be created.
child_support1().SubmitCompositorFrame(child_id.local_surface_id(),
- CompositorFrame());
+ MakeCompositorFrame());
EXPECT_NE(nullptr, surface_manager().GetSurfaceForId(child_id));
}

Powered by Google App Engine
This is Rietveld 408576698