Index: cc/surfaces/surfaces_pixeltest.cc |
diff --git a/cc/surfaces/surfaces_pixeltest.cc b/cc/surfaces/surfaces_pixeltest.cc |
index 026db2d3cd0d0c45f7f2e266775b75426cfbb06f..f7acc26b4a26c72249dd60b005074d6be5c0e8d2 100644 |
--- a/cc/surfaces/surfaces_pixeltest.cc |
+++ b/cc/surfaces/surfaces_pixeltest.cc |
@@ -21,7 +21,10 @@ |
namespace cc { |
namespace { |
-static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); |
+static constexpr FrameSinkId kArbitraryRootFrameSinkId(1, 1); |
+static constexpr FrameSinkId kArbitraryChildFrameSinkId(2, 2); |
+static constexpr FrameSinkId kArbitraryLeftFrameSinkId(3, 3); |
+static constexpr FrameSinkId kArbitraryRightFrameSinkId(4, 4); |
class EmptySurfaceFactoryClient : public SurfaceFactoryClient { |
public: |
@@ -31,7 +34,9 @@ class EmptySurfaceFactoryClient : public SurfaceFactoryClient { |
class SurfacesPixelTest : public RendererPixelTest<GLRenderer> { |
public: |
- SurfacesPixelTest() : factory_(kArbitraryFrameSinkId, &manager_, &client_) {} |
+ SurfacesPixelTest() |
+ : factory_(kArbitraryRootFrameSinkId, &manager_, &client_) {} |
+ ~SurfacesPixelTest() override { factory_.EvictSurface(); } |
protected: |
SurfaceManager manager_; |
@@ -81,13 +86,11 @@ TEST_F(SurfacesPixelTest, DrawSimpleFrame) { |
LocalFrameId root_local_frame_id = allocator_.GenerateId(); |
SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id); |
- factory_.Create(root_local_frame_id); |
factory_.SubmitCompositorFrame(root_local_frame_id, std::move(root_frame), |
SurfaceFactory::DrawCallback()); |
SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true); |
CompositorFrame aggregated_frame = aggregator.Aggregate(root_surface_id); |
- factory_.Destroy(root_local_frame_id); |
bool discard_alpha = false; |
ExactPixelComparator pixel_comparator(discard_alpha); |
@@ -100,13 +103,13 @@ TEST_F(SurfacesPixelTest, DrawSimpleFrame) { |
// Draws a frame with simple surface embedding. |
TEST_F(SurfacesPixelTest, DrawSimpleAggregatedFrame) { |
gfx::Size child_size(200, 100); |
+ SurfaceFactory child_factory(kArbitraryChildFrameSinkId, &manager_, &client_); |
LocalFrameId child_local_frame_id = allocator_.GenerateId(); |
- SurfaceId child_surface_id(factory_.frame_sink_id(), child_local_frame_id); |
+ SurfaceId child_surface_id(child_factory.frame_sink_id(), |
+ child_local_frame_id); |
LocalFrameId root_local_frame_id = allocator_.GenerateId(); |
SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id); |
- factory_.Create(child_local_frame_id); |
- factory_.Create(root_local_frame_id); |
{ |
gfx::Rect rect(device_viewport_size_); |
RenderPassId id(1, 1); |
@@ -160,8 +163,9 @@ TEST_F(SurfacesPixelTest, DrawSimpleAggregatedFrame) { |
CompositorFrame child_frame; |
child_frame.render_pass_list.push_back(std::move(pass)); |
- factory_.SubmitCompositorFrame(child_local_frame_id, std::move(child_frame), |
- SurfaceFactory::DrawCallback()); |
+ child_factory.SubmitCompositorFrame(child_local_frame_id, |
+ std::move(child_frame), |
+ SurfaceFactory::DrawCallback()); |
} |
SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true); |
@@ -173,8 +177,8 @@ TEST_F(SurfacesPixelTest, DrawSimpleAggregatedFrame) { |
EXPECT_TRUE(RunPixelTest(pass_list, |
base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")), |
pixel_comparator)); |
- factory_.Destroy(root_local_frame_id); |
- factory_.Destroy(child_local_frame_id); |
+ |
+ child_factory.EvictSurface(); |
} |
// Tests a surface quad that has a non-identity transform into its pass. |
@@ -188,15 +192,14 @@ TEST_F(SurfacesPixelTest, DrawAggregatedFrameWithSurfaceTransforms) { |
// bottom_blue_quad (100x100 @ 0x100) |
// right_child -> top_blue_quad (100x100 @ 0x0), |
// bottom_green_quad (100x100 @ 0x100) |
+ SurfaceFactory left_factory(kArbitraryLeftFrameSinkId, &manager_, &client_); |
+ SurfaceFactory right_factory(kArbitraryRightFrameSinkId, &manager_, &client_); |
LocalFrameId left_child_local_id = allocator_.GenerateId(); |
- SurfaceId left_child_id(factory_.frame_sink_id(), left_child_local_id); |
+ SurfaceId left_child_id(left_factory.frame_sink_id(), left_child_local_id); |
LocalFrameId right_child_local_id = allocator_.GenerateId(); |
- SurfaceId right_child_id(factory_.frame_sink_id(), right_child_local_id); |
+ SurfaceId right_child_id(right_factory.frame_sink_id(), right_child_local_id); |
LocalFrameId root_local_frame_id = allocator_.GenerateId(); |
SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id); |
- factory_.Create(left_child_local_id); |
- factory_.Create(right_child_local_id); |
- factory_.Create(root_local_frame_id); |
{ |
gfx::Rect rect(device_viewport_size_); |
@@ -262,8 +265,9 @@ TEST_F(SurfacesPixelTest, DrawAggregatedFrameWithSurfaceTransforms) { |
CompositorFrame child_frame; |
child_frame.render_pass_list.push_back(std::move(pass)); |
- factory_.SubmitCompositorFrame(left_child_local_id, std::move(child_frame), |
- SurfaceFactory::DrawCallback()); |
+ left_factory.SubmitCompositorFrame(left_child_local_id, |
+ std::move(child_frame), |
+ SurfaceFactory::DrawCallback()); |
} |
{ |
@@ -295,8 +299,9 @@ TEST_F(SurfacesPixelTest, DrawAggregatedFrameWithSurfaceTransforms) { |
CompositorFrame child_frame; |
child_frame.render_pass_list.push_back(std::move(pass)); |
- factory_.SubmitCompositorFrame(right_child_local_id, std::move(child_frame), |
- SurfaceFactory::DrawCallback()); |
+ right_factory.SubmitCompositorFrame(right_child_local_id, |
+ std::move(child_frame), |
+ SurfaceFactory::DrawCallback()); |
} |
SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true); |
@@ -310,9 +315,8 @@ TEST_F(SurfacesPixelTest, DrawAggregatedFrameWithSurfaceTransforms) { |
base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), |
pixel_comparator)); |
- factory_.Destroy(root_local_frame_id); |
- factory_.Destroy(left_child_local_id); |
- factory_.Destroy(right_child_local_id); |
+ left_factory.EvictSurface(); |
+ right_factory.EvictSurface(); |
} |
} // namespace |