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

Unified Diff: cc/surfaces/surfaces_pixeltest.cc

Issue 2795683003: [cc]Replace use of SurfaceFactory with CompositorFrameSinkSupport in tests (Closed)
Patch Set: 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/surfaces_pixeltest.cc
diff --git a/cc/surfaces/surfaces_pixeltest.cc b/cc/surfaces/surfaces_pixeltest.cc
index b98098070350b2d6dac9e1ebb79ee8f30d011f6d..a8af17fe59ce16b4c8591dccd79e57164d00a448 100644
--- a/cc/surfaces/surfaces_pixeltest.cc
+++ b/cc/surfaces/surfaces_pixeltest.cc
@@ -6,11 +6,10 @@
#include "cc/quads/render_pass.h"
#include "cc/quads/solid_color_draw_quad.h"
#include "cc/quads/surface_draw_quad.h"
+#include "cc/surfaces/compositor_frame_sink_support.h"
#include "cc/surfaces/local_surface_id_allocator.h"
#include "cc/surfaces/surface.h"
#include "cc/surfaces/surface_aggregator.h"
-#include "cc/surfaces/surface_factory.h"
-#include "cc/surfaces/surface_factory_client.h"
#include "cc/surfaces/surface_manager.h"
#include "cc/test/pixel_comparator.h"
#include "cc/test/pixel_test.h"
@@ -26,23 +25,23 @@ static constexpr FrameSinkId kArbitraryChildFrameSinkId(2, 2);
static constexpr FrameSinkId kArbitraryLeftFrameSinkId(3, 3);
static constexpr FrameSinkId kArbitraryRightFrameSinkId(4, 4);
Fady Samuel 2017/04/03 22:33:25 get rid of all these statics.
Alex Z. 2017/04/04 14:10:33 Done.
-class EmptySurfaceFactoryClient : public SurfaceFactoryClient {
- public:
- void ReturnResources(const ReturnedResourceArray& resources) override {}
- void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override {}
-};
-
class SurfacesPixelTest : public RendererPixelTest<GLRenderer> {
public:
SurfacesPixelTest()
- : factory_(kArbitraryRootFrameSinkId, &manager_, &client_) {}
- ~SurfacesPixelTest() override { factory_.EvictSurface(); }
+ : support_(nullptr,
+ &manager_,
+ kArbitraryRootFrameSinkId,
+ true /* is_root */,
+ true /* handles_frame_sink_id_invalidation */,
+ true /* needs_sync_points */) {}
+ ~SurfacesPixelTest() override { support_.EvictFrame(); }
protected:
+ static constexpr bool handles_frame_sink_id_invalidation_ = true;
+ static constexpr bool needs_sync_points_ = true;
Fady Samuel 2017/04/03 22:33:25 Put these in the anonymous namespace about. Don't
Alex Z. 2017/04/04 14:10:33 Done.
SurfaceManager manager_;
LocalSurfaceIdAllocator allocator_;
- EmptySurfaceFactoryClient client_;
- SurfaceFactory factory_;
+ CompositorFrameSinkSupport support_;
};
SharedQuadState* CreateAndAppendTestSharedQuadState(
@@ -85,9 +84,8 @@ TEST_F(SurfacesPixelTest, DrawSimpleFrame) {
root_frame.render_pass_list.push_back(std::move(pass));
LocalSurfaceId root_local_surface_id = allocator_.GenerateId();
- SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_surface_id);
- factory_.SubmitCompositorFrame(root_local_surface_id, std::move(root_frame),
- SurfaceFactory::DrawCallback());
+ SurfaceId root_surface_id(support_.frame_sink_id(), root_local_surface_id);
+ support_.SubmitCompositorFrame(root_local_surface_id, std::move(root_frame));
SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true);
CompositorFrame aggregated_frame = aggregator.Aggregate(root_surface_id);
@@ -103,12 +101,16 @@ 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_);
+ constexpr bool is_root = false;
+ CompositorFrameSinkSupport child_support(
+ nullptr, &manager_, kArbitraryChildFrameSinkId, is_root,
+ handles_frame_sink_id_invalidation_, needs_sync_points_);
+
LocalSurfaceId child_local_surface_id = allocator_.GenerateId();
- SurfaceId child_surface_id(child_factory.frame_sink_id(),
+ SurfaceId child_surface_id(child_support.frame_sink_id(),
child_local_surface_id);
LocalSurfaceId root_local_surface_id = allocator_.GenerateId();
- SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_surface_id);
+ SurfaceId root_surface_id(support_.frame_sink_id(), root_local_surface_id);
{
gfx::Rect rect(device_viewport_size_);
@@ -138,8 +140,8 @@ TEST_F(SurfacesPixelTest, DrawSimpleAggregatedFrame) {
CompositorFrame root_frame;
root_frame.render_pass_list.push_back(std::move(pass));
- factory_.SubmitCompositorFrame(root_local_surface_id, std::move(root_frame),
- SurfaceFactory::DrawCallback());
+ support_.SubmitCompositorFrame(root_local_surface_id,
+ std::move(root_frame));
}
{
@@ -163,9 +165,8 @@ TEST_F(SurfacesPixelTest, DrawSimpleAggregatedFrame) {
CompositorFrame child_frame;
child_frame.render_pass_list.push_back(std::move(pass));
- child_factory.SubmitCompositorFrame(child_local_surface_id,
- std::move(child_frame),
- SurfaceFactory::DrawCallback());
+ child_support.SubmitCompositorFrame(child_local_surface_id,
+ std::move(child_frame));
}
SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true);
@@ -178,7 +179,7 @@ TEST_F(SurfacesPixelTest, DrawSimpleAggregatedFrame) {
base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")),
pixel_comparator));
- child_factory.EvictSurface();
+ child_support.EvictFrame();
}
// Tests a surface quad that has a non-identity transform into its pass.
@@ -192,14 +193,19 @@ 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_);
+ constexpr bool is_root = false;
+ CompositorFrameSinkSupport left_support(
+ nullptr, &manager_, kArbitraryLeftFrameSinkId, is_root,
+ handles_frame_sink_id_invalidation_, needs_sync_points_);
+ CompositorFrameSinkSupport right_support(
+ nullptr, &manager_, kArbitraryRightFrameSinkId, is_root,
+ handles_frame_sink_id_invalidation_, needs_sync_points_);
LocalSurfaceId left_child_local_id = allocator_.GenerateId();
- SurfaceId left_child_id(left_factory.frame_sink_id(), left_child_local_id);
+ SurfaceId left_child_id(left_support.frame_sink_id(), left_child_local_id);
LocalSurfaceId right_child_local_id = allocator_.GenerateId();
- SurfaceId right_child_id(right_factory.frame_sink_id(), right_child_local_id);
+ SurfaceId right_child_id(right_support.frame_sink_id(), right_child_local_id);
LocalSurfaceId root_local_surface_id = allocator_.GenerateId();
- SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_surface_id);
+ SurfaceId root_surface_id(support_.frame_sink_id(), root_local_surface_id);
{
gfx::Rect rect(device_viewport_size_);
@@ -232,8 +238,8 @@ TEST_F(SurfacesPixelTest, DrawAggregatedFrameWithSurfaceTransforms) {
CompositorFrame root_frame;
root_frame.render_pass_list.push_back(std::move(pass));
- factory_.SubmitCompositorFrame(root_local_surface_id, std::move(root_frame),
- SurfaceFactory::DrawCallback());
+ support_.SubmitCompositorFrame(root_local_surface_id,
+ std::move(root_frame));
}
{
@@ -265,9 +271,8 @@ TEST_F(SurfacesPixelTest, DrawAggregatedFrameWithSurfaceTransforms) {
CompositorFrame child_frame;
child_frame.render_pass_list.push_back(std::move(pass));
- left_factory.SubmitCompositorFrame(left_child_local_id,
- std::move(child_frame),
- SurfaceFactory::DrawCallback());
+ left_support.SubmitCompositorFrame(left_child_local_id,
+ std::move(child_frame));
}
{
@@ -299,9 +304,8 @@ TEST_F(SurfacesPixelTest, DrawAggregatedFrameWithSurfaceTransforms) {
CompositorFrame child_frame;
child_frame.render_pass_list.push_back(std::move(pass));
- right_factory.SubmitCompositorFrame(right_child_local_id,
- std::move(child_frame),
- SurfaceFactory::DrawCallback());
+ right_support.SubmitCompositorFrame(right_child_local_id,
+ std::move(child_frame));
}
SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true);
@@ -315,8 +319,8 @@ TEST_F(SurfacesPixelTest, DrawAggregatedFrameWithSurfaceTransforms) {
base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")),
pixel_comparator));
- left_factory.EvictSurface();
- right_factory.EvictSurface();
+ left_support.EvictFrame();
+ right_support.EvictFrame();
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698