Chromium Code Reviews| Index: cc/surfaces/surface_aggregator_unittest.cc |
| diff --git a/cc/surfaces/surface_aggregator_unittest.cc b/cc/surfaces/surface_aggregator_unittest.cc |
| index 4df989a8388a6ca2abaefd1c05cea261ede5308e..21876fe5783cf910185fcea1703f5a875e1a90d2 100644 |
| --- a/cc/surfaces/surface_aggregator_unittest.cc |
| +++ b/cc/surfaces/surface_aggregator_unittest.cc |
| @@ -260,6 +260,53 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, MultiPassSimpleFrame) { |
| AggregateAndVerify(passes, arraysize(passes), ids, arraysize(ids)); |
| } |
| +// Ensure that the render pass ID map properly keeps and deletes entries. |
| +TEST_F(SurfaceAggregatorValidSurfaceTest, MultiPassDeallocation) { |
| + test::Quad quads[][2] = {{test::Quad::SolidColorQuad(SK_ColorWHITE), |
| + test::Quad::SolidColorQuad(SK_ColorLTGRAY)}, |
| + {test::Quad::SolidColorQuad(SK_ColorGRAY), |
| + test::Quad::SolidColorQuad(SK_ColorDKGRAY)}}; |
| + test::Pass passes[] = { |
| + test::Pass(quads[0], arraysize(quads[0]), RenderPassId(1, 2)), |
| + test::Pass(quads[1], arraysize(quads[1]), RenderPassId(1, 1))}; |
| + |
| + SubmitCompositorFrame(&factory_, passes, arraysize(passes), |
| + root_local_frame_id_); |
| + |
| + SurfaceId surface_id(factory_.frame_sink_id(), root_local_frame_id_); |
| + |
| + CompositorFrame aggregated_frame; |
| + aggregated_frame = aggregator_.Aggregate(surface_id); |
| + EXPECT_EQ(RenderPassId(1, 2), aggregated_frame.render_pass_list[0]->id); |
|
danakj
2016/12/02 22:17:53
instead of hardcoding the result can u just store
|
| + EXPECT_EQ(RenderPassId(1, 1), aggregated_frame.render_pass_list[1]->id); |
| + |
| + // Aggregated RenderPassIds should remain the same between frames. |
| + aggregated_frame = aggregator_.Aggregate(surface_id); |
| + EXPECT_EQ(RenderPassId(1, 2), aggregated_frame.render_pass_list[0]->id); |
| + EXPECT_EQ(RenderPassId(1, 1), aggregated_frame.render_pass_list[1]->id); |
| + |
| + test::Pass passes2[] = { |
| + test::Pass(quads[0], arraysize(quads[0]), RenderPassId(1, 3)), |
| + test::Pass(quads[1], arraysize(quads[1]), RenderPassId(1, 1))}; |
| + |
| + SubmitCompositorFrame(&factory_, passes2, arraysize(passes2), |
| + root_local_frame_id_); |
| + |
| + // The RenderPass that still exists should keep the same ID. |
| + aggregated_frame = aggregator_.Aggregate(surface_id); |
| + EXPECT_EQ(RenderPassId(1, 3), aggregated_frame.render_pass_list[0]->id); |
|
danakj
2016/12/02 22:17:53
and then check this is a new thing with NE compare
|
| + EXPECT_EQ(RenderPassId(1, 1), aggregated_frame.render_pass_list[1]->id); |
| + |
| + SubmitCompositorFrame(&factory_, passes, arraysize(passes), |
| + root_local_frame_id_); |
| + |
| + // RenderPassId(1, 2) didn't exist in the previous frame, so it should be |
| + // mapped to a new ID. |
| + aggregated_frame = aggregator_.Aggregate(surface_id); |
| + EXPECT_EQ(RenderPassId(1, 4), aggregated_frame.render_pass_list[0]->id); |
|
danakj
2016/12/02 22:17:53
same same?
|
| + EXPECT_EQ(RenderPassId(1, 1), aggregated_frame.render_pass_list[1]->id); |
| +} |
| + |
| // This tests very simple embedding. root_surface has a frame containing a few |
| // solid color quads and a surface quad referencing embedded_surface. |
| // embedded_surface has a frame containing only a solid color quad. The solid |