1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CC_SURFACES_SURFACE_AGGREGATOR_TEST_HELPERS_H_
6 #define CC_SURFACES_SURFACE_AGGREGATOR_TEST_HELPERS_H_
8 #include "cc/base/scoped_ptr_vector.h"
9 #include "cc/quads/draw_quad.h"
10 #include "cc/quads/render_pass_id.h"
11 #include "cc/surfaces/surface_id.h"
12 #include "third_party/skia/include/core/SkColor.h"
13 #include "ui/gfx/geometry/size.h"
21 typedef ScopedPtrVector
<RenderPass
> RenderPassList
;
26 static Quad
SolidColorQuad(SkColor color
) {
28 quad
.material
= DrawQuad::SOLID_COLOR
;
33 static Quad
SurfaceQuad(SurfaceId surface_id
, float opacity
) {
35 quad
.material
= DrawQuad::SURFACE_CONTENT
;
36 quad
.opacity
= opacity
;
37 quad
.surface_id
= surface_id
;
41 static Quad
RenderPassQuad(RenderPassId id
) {
43 quad
.material
= DrawQuad::RENDER_PASS
;
44 quad
.render_pass_id
= id
;
48 DrawQuad::Material material
;
49 // Set when material==DrawQuad::SURFACE_CONTENT.
52 // Set when material==DrawQuad::SOLID_COLOR.
54 // Set when material==DrawQuad::RENDER_PASS.
55 RenderPassId render_pass_id
;
59 : material(DrawQuad::INVALID
),
62 render_pass_id(-1, -1) {}
66 Pass(Quad
* quads
, size_t quad_count
, RenderPassId id
)
67 : quads(quads
), quad_count(quad_count
), id(id
) {}
68 Pass(Quad
* quads
, size_t quad_count
)
69 : quads(quads
), quad_count(quad_count
), id(1, 1) {}
76 void AddSurfaceQuad(TestRenderPass
* pass
,
77 const gfx::Size
& surface_size
,
80 void AddQuadInPass(TestRenderPass
* pass
, Quad desc
);
82 void AddPasses(RenderPassList
* pass_list
,
83 const gfx::Rect
& output_rect
,
87 void TestQuadMatchesExpectations(Quad expected_quad
, const DrawQuad
* quad
);
89 void TestPassMatchesExpectations(Pass expected_pass
, const RenderPass
* pass
);
91 void TestPassesMatchExpectations(Pass
* expected_passes
,
92 size_t expected_pass_count
,
93 const RenderPassList
* passes
);
98 #endif // CC_SURFACES_SURFACE_AGGREGATOR_TEST_HELPERS_H_