blob: 11b9ea278d9644133f659fd28f118408b47da875 [file] [log] [blame]
[email protected]4934d362012-11-22 22:04:531// Copyright (c) 2012 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.
4
5#include "content/common/cc_messages.h"
6
7#include <string.h>
8
[email protected]032bfc42013-10-29 22:23:529#include <algorithm>
10
[email protected]7f0d825f2013-03-18 07:24:3011#include "cc/output/compositor_frame.h"
[email protected]4934d362012-11-22 22:04:5312#include "ipc/ipc_message.h"
13#include "testing/gtest/include/gtest/gtest.h"
[email protected]645a47f22013-09-26 05:42:3214#include "third_party/khronos/GLES2/gl2ext.h"
[email protected]a1765672013-08-12 23:45:0215#include "third_party/skia/include/effects/SkBlurImageFilter.h"
[email protected]4934d362012-11-22 22:04:5316
17using cc::CheckerboardDrawQuad;
[email protected]bf189f62012-12-18 03:42:1118using cc::DelegatedFrameData;
[email protected]4934d362012-11-22 22:04:5319using cc::DebugBorderDrawQuad;
20using cc::DrawQuad;
[email protected]ae6b1a72013-06-25 18:49:2921using cc::FilterOperation;
22using cc::FilterOperations;
[email protected]4934d362012-11-22 22:04:5323using cc::IOSurfaceDrawQuad;
[email protected]9ee4d3a2013-03-27 17:43:1624using cc::PictureDrawQuad;
[email protected]4934d362012-11-22 22:04:5325using cc::RenderPass;
26using cc::RenderPassDrawQuad;
27using cc::ResourceProvider;
28using cc::SharedQuadState;
29using cc::SolidColorDrawQuad;
[email protected]78d30122014-01-17 06:32:3630using cc::SurfaceDrawQuad;
[email protected]4934d362012-11-22 22:04:5331using cc::TextureDrawQuad;
32using cc::TileDrawQuad;
[email protected]bca159072012-12-04 00:52:4433using cc::TransferableResource;
[email protected]4934d362012-11-22 22:04:5334using cc::StreamVideoDrawQuad;
35using cc::VideoLayerImpl;
36using cc::YUVVideoDrawQuad;
[email protected]c8686a02012-11-27 08:29:0037using gfx::Transform;
[email protected]4934d362012-11-22 22:04:5338
[email protected]bca159072012-12-04 00:52:4439namespace content {
40namespace {
41
[email protected]4934d362012-11-22 22:04:5342class CCMessagesTest : public testing::Test {
43 protected:
44 void Compare(const RenderPass* a, const RenderPass* b) {
45 EXPECT_EQ(a->id, b->id);
46 EXPECT_EQ(a->output_rect.ToString(), b->output_rect.ToString());
47 EXPECT_EQ(a->damage_rect.ToString(), b->damage_rect.ToString());
48 EXPECT_EQ(a->transform_to_root_target, b->transform_to_root_target);
49 EXPECT_EQ(a->has_transparent_background, b->has_transparent_background);
[email protected]4934d362012-11-22 22:04:5350 }
51
52 void Compare(const SharedQuadState* a, const SharedQuadState* b) {
53 EXPECT_EQ(a->content_to_target_transform, b->content_to_target_transform);
[email protected]f902bf92013-03-04 18:33:2754 EXPECT_EQ(a->content_bounds, b->content_bounds);
[email protected]4934d362012-11-22 22:04:5355 EXPECT_EQ(a->visible_content_rect, b->visible_content_rect);
[email protected]4934d362012-11-22 22:04:5356 EXPECT_EQ(a->clip_rect, b->clip_rect);
57 EXPECT_EQ(a->is_clipped, b->is_clipped);
58 EXPECT_EQ(a->opacity, b->opacity);
[email protected]7bbeaf4e2013-11-26 10:27:2259 EXPECT_EQ(a->blend_mode, b->blend_mode);
[email protected]4934d362012-11-22 22:04:5360 }
61
62 void Compare(const DrawQuad* a, const DrawQuad* b) {
63 ASSERT_NE(DrawQuad::INVALID, a->material);
64 ASSERT_EQ(a->material, b->material);
65 EXPECT_EQ(a->rect.ToString(), b->rect.ToString());
66 EXPECT_EQ(a->opaque_rect.ToString(), b->opaque_rect.ToString());
67 EXPECT_EQ(a->visible_rect.ToString(), b->visible_rect.ToString());
68 EXPECT_EQ(a->needs_blending, b->needs_blending);
69
70 Compare(a->shared_quad_state, b->shared_quad_state);
71
72 switch (a->material) {
73 case DrawQuad::CHECKERBOARD:
74 Compare(CheckerboardDrawQuad::MaterialCast(a),
75 CheckerboardDrawQuad::MaterialCast(b));
76 break;
77 case DrawQuad::DEBUG_BORDER:
78 Compare(DebugBorderDrawQuad::MaterialCast(a),
79 DebugBorderDrawQuad::MaterialCast(b));
80 break;
81 case DrawQuad::IO_SURFACE_CONTENT:
82 Compare(IOSurfaceDrawQuad::MaterialCast(a),
83 IOSurfaceDrawQuad::MaterialCast(b));
84 break;
[email protected]9ee4d3a2013-03-27 17:43:1685 case DrawQuad::PICTURE_CONTENT:
86 Compare(PictureDrawQuad::MaterialCast(a),
87 PictureDrawQuad::MaterialCast(b));
88 break;
[email protected]4934d362012-11-22 22:04:5389 case DrawQuad::RENDER_PASS:
90 Compare(RenderPassDrawQuad::MaterialCast(a),
91 RenderPassDrawQuad::MaterialCast(b));
92 break;
93 case DrawQuad::TEXTURE_CONTENT:
94 Compare(TextureDrawQuad::MaterialCast(a),
95 TextureDrawQuad::MaterialCast(b));
96 break;
97 case DrawQuad::TILED_CONTENT:
98 Compare(TileDrawQuad::MaterialCast(a),
99 TileDrawQuad::MaterialCast(b));
100 break;
101 case DrawQuad::SOLID_COLOR:
102 Compare(SolidColorDrawQuad::MaterialCast(a),
103 SolidColorDrawQuad::MaterialCast(b));
104 break;
105 case DrawQuad::STREAM_VIDEO_CONTENT:
106 Compare(StreamVideoDrawQuad::MaterialCast(a),
107 StreamVideoDrawQuad::MaterialCast(b));
108 break;
[email protected]78d30122014-01-17 06:32:36109 case DrawQuad::SURFACE_CONTENT:
110 Compare(SurfaceDrawQuad::MaterialCast(a),
111 SurfaceDrawQuad::MaterialCast(b));
112 break;
[email protected]4934d362012-11-22 22:04:53113 case DrawQuad::YUV_VIDEO_CONTENT:
114 Compare(YUVVideoDrawQuad::MaterialCast(a),
115 YUVVideoDrawQuad::MaterialCast(b));
116 break;
117 case DrawQuad::INVALID:
118 break;
119 }
120 }
121
122 void Compare(const CheckerboardDrawQuad* a, const CheckerboardDrawQuad* b) {
123 EXPECT_EQ(a->color, b->color);
124 }
125
126 void Compare(const DebugBorderDrawQuad* a, const DebugBorderDrawQuad* b) {
127 EXPECT_EQ(a->color, b->color);
128 EXPECT_EQ(a->width, b->width);
129 }
130
131 void Compare(const IOSurfaceDrawQuad* a, const IOSurfaceDrawQuad* b) {
132 EXPECT_EQ(a->io_surface_size.ToString(), b->io_surface_size.ToString());
[email protected]b7cfc632013-04-10 04:44:49133 EXPECT_EQ(a->io_surface_resource_id, b->io_surface_resource_id);
[email protected]4934d362012-11-22 22:04:53134 EXPECT_EQ(a->orientation, b->orientation);
135 }
136
137 void Compare(const RenderPassDrawQuad* a, const RenderPassDrawQuad* b) {
[email protected]82f93fb2013-04-17 21:42:06138 EXPECT_EQ(a->render_pass_id, b->render_pass_id);
[email protected]4934d362012-11-22 22:04:53139 EXPECT_EQ(a->is_replica, b->is_replica);
140 EXPECT_EQ(a->mask_resource_id, b->mask_resource_id);
141 EXPECT_EQ(a->contents_changed_since_last_frame,
142 b->contents_changed_since_last_frame);
[email protected]458af1e2012-12-13 05:12:18143 EXPECT_EQ(a->mask_uv_rect.ToString(), b->mask_uv_rect.ToString());
[email protected]1dc7943e2013-09-26 04:41:48144 EXPECT_EQ(a->filters.size(), b->filters.size());
145 for (size_t i = 0; i < a->filters.size(); ++i) {
146 if (a->filters.at(i).type() != cc::FilterOperation::REFERENCE) {
147 EXPECT_EQ(a->filters.at(i), b->filters.at(i));
148 } else {
149 EXPECT_EQ(b->filters.at(i).type(), cc::FilterOperation::REFERENCE);
150 EXPECT_EQ(a->filters.at(i).image_filter()->countInputs(),
151 b->filters.at(i).image_filter()->countInputs());
152 }
153 }
[email protected]20062042012-12-21 22:16:36154 EXPECT_EQ(a->background_filters, b->background_filters);
[email protected]4934d362012-11-22 22:04:53155 }
156
157 void Compare(const SolidColorDrawQuad* a, const SolidColorDrawQuad* b) {
158 EXPECT_EQ(a->color, b->color);
[email protected]10a30b12013-05-02 16:42:11159 EXPECT_EQ(a->force_anti_aliasing_off, b->force_anti_aliasing_off);
[email protected]4934d362012-11-22 22:04:53160 }
161
162 void Compare(const StreamVideoDrawQuad* a, const StreamVideoDrawQuad* b) {
[email protected]b7cfc632013-04-10 04:44:49163 EXPECT_EQ(a->resource_id, b->resource_id);
[email protected]4934d362012-11-22 22:04:53164 EXPECT_EQ(a->matrix, b->matrix);
165 }
166
[email protected]78d30122014-01-17 06:32:36167 void Compare(const SurfaceDrawQuad* a, const SurfaceDrawQuad* b) {
168 EXPECT_EQ(a->surface_id, b->surface_id);
169 }
170
[email protected]4934d362012-11-22 22:04:53171 void Compare(const TextureDrawQuad* a, const TextureDrawQuad* b) {
172 EXPECT_EQ(a->resource_id, b->resource_id);
173 EXPECT_EQ(a->premultiplied_alpha, b->premultiplied_alpha);
[email protected]1fd555b2013-01-18 00:13:21174 EXPECT_EQ(a->uv_top_left, b->uv_top_left);
175 EXPECT_EQ(a->uv_bottom_right, b->uv_bottom_right);
[email protected]d18b4d62013-07-12 05:33:49176 EXPECT_EQ(a->background_color, b->background_color);
[email protected]61df9d82013-01-30 02:32:42177 EXPECT_EQ(a->vertex_opacity[0], b->vertex_opacity[0]);
178 EXPECT_EQ(a->vertex_opacity[1], b->vertex_opacity[1]);
179 EXPECT_EQ(a->vertex_opacity[2], b->vertex_opacity[2]);
180 EXPECT_EQ(a->vertex_opacity[3], b->vertex_opacity[3]);
[email protected]4934d362012-11-22 22:04:53181 EXPECT_EQ(a->flipped, b->flipped);
182 }
183
184 void Compare(const TileDrawQuad* a, const TileDrawQuad* b) {
185 EXPECT_EQ(a->resource_id, b->resource_id);
186 EXPECT_EQ(a->tex_coord_rect, b->tex_coord_rect);
187 EXPECT_EQ(a->texture_size, b->texture_size);
188 EXPECT_EQ(a->swizzle_contents, b->swizzle_contents);
[email protected]4934d362012-11-22 22:04:53189 }
190
191 void Compare(const YUVVideoDrawQuad* a, const YUVVideoDrawQuad* b) {
192 EXPECT_EQ(a->tex_scale, b->tex_scale);
[email protected]b7cfc632013-04-10 04:44:49193 EXPECT_EQ(a->y_plane_resource_id, b->y_plane_resource_id);
194 EXPECT_EQ(a->u_plane_resource_id, b->u_plane_resource_id);
195 EXPECT_EQ(a->v_plane_resource_id, b->v_plane_resource_id);
[email protected]0402b2382013-06-07 21:50:54196 EXPECT_EQ(a->a_plane_resource_id, b->a_plane_resource_id);
[email protected]4934d362012-11-22 22:04:53197 }
[email protected]bca159072012-12-04 00:52:44198
199 void Compare(const TransferableResource& a, const TransferableResource& b) {
200 EXPECT_EQ(a.id, b.id);
[email protected]bca159072012-12-04 00:52:44201 EXPECT_EQ(a.format, b.format);
[email protected]80189292013-02-28 01:59:36202 EXPECT_EQ(a.filter, b.filter);
[email protected]bca159072012-12-04 00:52:44203 EXPECT_EQ(a.size.ToString(), b.size.ToString());
[email protected]df41e252014-02-03 23:39:50204 for (size_t i = 0; i < arraysize(a.mailbox_holder.mailbox.name); ++i) {
205 EXPECT_EQ(a.mailbox_holder.mailbox.name[i],
206 b.mailbox_holder.mailbox.name[i]);
207 }
208 EXPECT_EQ(a.mailbox_holder.texture_target, b.mailbox_holder.texture_target);
209 EXPECT_EQ(a.mailbox_holder.sync_point, b.mailbox_holder.sync_point);
[email protected]bca159072012-12-04 00:52:44210 }
[email protected]4934d362012-11-22 22:04:53211};
212
213TEST_F(CCMessagesTest, AllQuads) {
[email protected]753bb252013-11-04 22:28:12214 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
[email protected]4934d362012-11-22 22:04:53215
[email protected]c8686a02012-11-27 08:29:00216 Transform arbitrary_matrix;
217 arbitrary_matrix.Scale(3, 3);
218 arbitrary_matrix.Translate(-5, 20);
219 arbitrary_matrix.Rotate(15);
[email protected]4934d362012-11-22 22:04:53220 gfx::Rect arbitrary_rect1(-5, 9, 3, 15);
[email protected]8e1da692013-10-12 17:11:30221 gfx::Rect arbitrary_rect1_inside_rect1(-4, 12, 2, 8);
222 gfx::Rect arbitrary_rect2_inside_rect1(-5, 11, 1, 2);
[email protected]4934d362012-11-22 22:04:53223 gfx::Rect arbitrary_rect2(40, 23, 11, 7);
[email protected]8e1da692013-10-12 17:11:30224 gfx::Rect arbitrary_rect1_inside_rect2(44, 23, 4, 2);
225 gfx::Rect arbitrary_rect2_inside_rect2(41, 25, 3, 5);
[email protected]4934d362012-11-22 22:04:53226 gfx::Rect arbitrary_rect3(7, -53, 22, 19);
[email protected]8e1da692013-10-12 17:11:30227 gfx::Rect arbitrary_rect1_inside_rect3(10, -40, 6, 3);
228 gfx::Rect arbitrary_rect2_inside_rect3(12, -51, 5, 12);
[email protected]4934d362012-11-22 22:04:53229 gfx::Size arbitrary_size1(15, 19);
230 gfx::Size arbitrary_size2(3, 99);
231 gfx::Size arbitrary_size3(75, 1281);
232 gfx::RectF arbitrary_rectf1(4.2f, -922.1f, 15.6f, 29.5f);
233 gfx::SizeF arbitrary_sizef1(15.2f, 104.6f);
[email protected]61df9d82013-01-30 02:32:42234 gfx::PointF arbitrary_pointf1(31.4f, 15.9f);
235 gfx::PointF arbitrary_pointf2(26.5f, -35.8f);
[email protected]4934d362012-11-22 22:04:53236 float arbitrary_float1 = 0.7f;
237 float arbitrary_float2 = 0.3f;
238 float arbitrary_float3 = 0.9f;
[email protected]61df9d82013-01-30 02:32:42239 float arbitrary_float_array[4] = {3.5f, 6.2f, 9.3f, 12.3f};
[email protected]4934d362012-11-22 22:04:53240 bool arbitrary_bool1 = true;
241 bool arbitrary_bool2 = false;
[email protected]61df9d82013-01-30 02:32:42242 bool arbitrary_bool3 = true;
[email protected]4934d362012-11-22 22:04:53243 int arbitrary_int = 5;
244 SkColor arbitrary_color = SkColorSetARGB(25, 36, 47, 58);
[email protected]7bbeaf4e2013-11-26 10:27:22245 SkXfermode::Mode arbitrary_blend_mode1 = SkXfermode::kScreen_Mode;
246 SkXfermode::Mode arbitrary_blend_mode2 = SkXfermode::kLighten_Mode;
247 SkXfermode::Mode arbitrary_blend_mode3 = SkXfermode::kOverlay_Mode;
[email protected]4934d362012-11-22 22:04:53248 IOSurfaceDrawQuad::Orientation arbitrary_orientation =
249 IOSurfaceDrawQuad::UNFLIPPED;
250 RenderPass::Id arbitrary_id(10, 14);
[email protected]b7cfc632013-04-10 04:44:49251 ResourceProvider::ResourceId arbitrary_resourceid1 = 55;
252 ResourceProvider::ResourceId arbitrary_resourceid2 = 47;
253 ResourceProvider::ResourceId arbitrary_resourceid3 = 23;
[email protected]0402b2382013-06-07 21:50:54254 ResourceProvider::ResourceId arbitrary_resourceid4 = 16;
[email protected]a1765672013-08-12 23:45:02255 SkScalar arbitrary_sigma = SkFloatToScalar(2.0f);
[email protected]4934d362012-11-22 22:04:53256
[email protected]ae6b1a72013-06-25 18:49:29257 FilterOperations arbitrary_filters1;
258 arbitrary_filters1.Append(FilterOperation::CreateGrayscaleFilter(
[email protected]4934d362012-11-22 22:04:53259 arbitrary_float1));
[email protected]1dc7943e2013-09-26 04:41:48260 skia::RefPtr<SkImageFilter> arbitrary_filter = skia::AdoptRef(
261 new SkBlurImageFilter(arbitrary_sigma, arbitrary_sigma));
262 arbitrary_filters1.Append(
263 cc::FilterOperation::CreateReferenceFilter(arbitrary_filter));
[email protected]4934d362012-11-22 22:04:53264
[email protected]ae6b1a72013-06-25 18:49:29265 FilterOperations arbitrary_filters2;
266 arbitrary_filters2.Append(FilterOperation::CreateBrightnessFilter(
[email protected]4934d362012-11-22 22:04:53267 arbitrary_float2));
268
269 scoped_ptr<SharedQuadState> shared_state1_in = SharedQuadState::Create();
270 shared_state1_in->SetAll(arbitrary_matrix,
[email protected]f902bf92013-03-04 18:33:27271 arbitrary_size1,
[email protected]4934d362012-11-22 22:04:53272 arbitrary_rect1,
273 arbitrary_rect2,
[email protected]4934d362012-11-22 22:04:53274 arbitrary_bool1,
[email protected]7bbeaf4e2013-11-26 10:27:22275 arbitrary_float1,
276 arbitrary_blend_mode1);
[email protected]4934d362012-11-22 22:04:53277 scoped_ptr<SharedQuadState> shared_state1_cmp = shared_state1_in->Copy();
278
279 scoped_ptr<CheckerboardDrawQuad> checkerboard_in =
280 CheckerboardDrawQuad::Create();
281 checkerboard_in->SetAll(shared_state1_in.get(),
282 arbitrary_rect1,
[email protected]8e1da692013-10-12 17:11:30283 arbitrary_rect2_inside_rect1,
284 arbitrary_rect1_inside_rect1,
[email protected]4934d362012-11-22 22:04:53285 arbitrary_bool1,
286 arbitrary_color);
287 scoped_ptr<DrawQuad> checkerboard_cmp = checkerboard_in->Copy(
288 checkerboard_in->shared_quad_state);
289
290 scoped_ptr<DebugBorderDrawQuad> debugborder_in =
291 DebugBorderDrawQuad::Create();
292 debugborder_in->SetAll(shared_state1_in.get(),
293 arbitrary_rect3,
[email protected]8e1da692013-10-12 17:11:30294 arbitrary_rect1_inside_rect3,
295 arbitrary_rect2_inside_rect3,
[email protected]4934d362012-11-22 22:04:53296 arbitrary_bool1,
297 arbitrary_color,
298 arbitrary_int);
299 scoped_ptr<DrawQuad> debugborder_cmp = debugborder_in->Copy(
300 debugborder_in->shared_quad_state);
301
302 scoped_ptr<IOSurfaceDrawQuad> iosurface_in =
303 IOSurfaceDrawQuad::Create();
304 iosurface_in->SetAll(shared_state1_in.get(),
305 arbitrary_rect2,
[email protected]8e1da692013-10-12 17:11:30306 arbitrary_rect2_inside_rect2,
307 arbitrary_rect1_inside_rect2,
[email protected]4934d362012-11-22 22:04:53308 arbitrary_bool1,
309 arbitrary_size1,
[email protected]b7cfc632013-04-10 04:44:49310 arbitrary_resourceid3,
[email protected]4934d362012-11-22 22:04:53311 arbitrary_orientation);
312 scoped_ptr<DrawQuad> iosurface_cmp = iosurface_in->Copy(
313 iosurface_in->shared_quad_state);
314
[email protected]cbe94b7a2013-11-13 11:03:37315 scoped_ptr<SharedQuadState> shared_state2_in = SharedQuadState::Create();
316 shared_state2_in->SetAll(arbitrary_matrix,
317 arbitrary_size2,
318 arbitrary_rect2,
319 arbitrary_rect3,
320 arbitrary_bool1,
[email protected]7bbeaf4e2013-11-26 10:27:22321 arbitrary_float2,
322 arbitrary_blend_mode2);
[email protected]cbe94b7a2013-11-13 11:03:37323 scoped_ptr<SharedQuadState> shared_state2_cmp = shared_state2_in->Copy();
324
[email protected]4934d362012-11-22 22:04:53325 scoped_ptr<RenderPassDrawQuad> renderpass_in =
326 RenderPassDrawQuad::Create();
[email protected]cbe94b7a2013-11-13 11:03:37327 renderpass_in->SetAll(shared_state2_in.get(),
[email protected]4934d362012-11-22 22:04:53328 arbitrary_rect1,
[email protected]8e1da692013-10-12 17:11:30329 arbitrary_rect2_inside_rect1,
330 arbitrary_rect1_inside_rect1,
[email protected]4934d362012-11-22 22:04:53331 arbitrary_bool1,
332 arbitrary_id,
333 arbitrary_bool2,
[email protected]b7cfc632013-04-10 04:44:49334 arbitrary_resourceid2,
[email protected]4934d362012-11-22 22:04:53335 arbitrary_rect1,
[email protected]20062042012-12-21 22:16:36336 arbitrary_rectf1,
337 arbitrary_filters1,
[email protected]20062042012-12-21 22:16:36338 arbitrary_filters2);
[email protected]4934d362012-11-22 22:04:53339 scoped_ptr<RenderPassDrawQuad> renderpass_cmp = renderpass_in->Copy(
340 renderpass_in->shared_quad_state, renderpass_in->render_pass_id);
341
[email protected]4934d362012-11-22 22:04:53342 scoped_ptr<SharedQuadState> shared_state3_in = SharedQuadState::Create();
343 shared_state3_in->SetAll(arbitrary_matrix,
[email protected]f902bf92013-03-04 18:33:27344 arbitrary_size3,
[email protected]4934d362012-11-22 22:04:53345 arbitrary_rect3,
346 arbitrary_rect1,
[email protected]4934d362012-11-22 22:04:53347 arbitrary_bool1,
[email protected]7bbeaf4e2013-11-26 10:27:22348 arbitrary_float3,
349 arbitrary_blend_mode3);
[email protected]4934d362012-11-22 22:04:53350 scoped_ptr<SharedQuadState> shared_state3_cmp = shared_state3_in->Copy();
351
352 scoped_ptr<SolidColorDrawQuad> solidcolor_in =
353 SolidColorDrawQuad::Create();
[email protected]cbe94b7a2013-11-13 11:03:37354 solidcolor_in->SetAll(shared_state3_in.get(),
[email protected]4934d362012-11-22 22:04:53355 arbitrary_rect3,
[email protected]8e1da692013-10-12 17:11:30356 arbitrary_rect1_inside_rect3,
357 arbitrary_rect2_inside_rect3,
[email protected]4934d362012-11-22 22:04:53358 arbitrary_bool1,
[email protected]10a30b12013-05-02 16:42:11359 arbitrary_color,
360 arbitrary_bool2);
[email protected]4934d362012-11-22 22:04:53361 scoped_ptr<DrawQuad> solidcolor_cmp = solidcolor_in->Copy(
362 solidcolor_in->shared_quad_state);
363
364 scoped_ptr<StreamVideoDrawQuad> streamvideo_in =
365 StreamVideoDrawQuad::Create();
[email protected]cbe94b7a2013-11-13 11:03:37366 streamvideo_in->SetAll(shared_state3_in.get(),
[email protected]4934d362012-11-22 22:04:53367 arbitrary_rect2,
[email protected]8e1da692013-10-12 17:11:30368 arbitrary_rect2_inside_rect2,
369 arbitrary_rect1_inside_rect2,
[email protected]4934d362012-11-22 22:04:53370 arbitrary_bool1,
[email protected]b7cfc632013-04-10 04:44:49371 arbitrary_resourceid2,
[email protected]4934d362012-11-22 22:04:53372 arbitrary_matrix);
373 scoped_ptr<DrawQuad> streamvideo_cmp = streamvideo_in->Copy(
374 streamvideo_in->shared_quad_state);
375
[email protected]78d30122014-01-17 06:32:36376 int arbitrary_surface_id = 3;
377 scoped_ptr<SurfaceDrawQuad> surface_in = SurfaceDrawQuad::Create();
378 surface_in->SetAll(shared_state3_in.get(),
379 arbitrary_rect2,
380 arbitrary_rect2_inside_rect2,
381 arbitrary_rect1_inside_rect2,
382 arbitrary_bool1,
383 arbitrary_surface_id);
384 scoped_ptr<DrawQuad> surface_cmp = surface_in->Copy(
385 surface_in->shared_quad_state);
386
[email protected]61df9d82013-01-30 02:32:42387 scoped_ptr<TextureDrawQuad> texture_in = TextureDrawQuad::Create();
[email protected]cbe94b7a2013-11-13 11:03:37388 texture_in->SetAll(shared_state3_in.get(),
[email protected]61df9d82013-01-30 02:32:42389 arbitrary_rect2,
[email protected]8e1da692013-10-12 17:11:30390 arbitrary_rect2_inside_rect2,
391 arbitrary_rect1_inside_rect2,
[email protected]61df9d82013-01-30 02:32:42392 arbitrary_bool1,
[email protected]b7cfc632013-04-10 04:44:49393 arbitrary_resourceid1,
[email protected]61df9d82013-01-30 02:32:42394 arbitrary_bool2,
395 arbitrary_pointf1,
396 arbitrary_pointf2,
[email protected]d18b4d62013-07-12 05:33:49397 arbitrary_color,
[email protected]61df9d82013-01-30 02:32:42398 arbitrary_float_array,
399 arbitrary_bool3);
400 scoped_ptr<DrawQuad> texture_cmp = texture_in->Copy(
401 texture_in->shared_quad_state);
402
403 scoped_ptr<TileDrawQuad> tile_in = TileDrawQuad::Create();
[email protected]cbe94b7a2013-11-13 11:03:37404 tile_in->SetAll(shared_state3_in.get(),
[email protected]61df9d82013-01-30 02:32:42405 arbitrary_rect2,
[email protected]8e1da692013-10-12 17:11:30406 arbitrary_rect2_inside_rect2,
407 arbitrary_rect1_inside_rect2,
[email protected]61df9d82013-01-30 02:32:42408 arbitrary_bool1,
[email protected]b7cfc632013-04-10 04:44:49409 arbitrary_resourceid3,
[email protected]61df9d82013-01-30 02:32:42410 arbitrary_rectf1,
411 arbitrary_size1,
[email protected]f902bf92013-03-04 18:33:27412 arbitrary_bool2);
[email protected]61df9d82013-01-30 02:32:42413 scoped_ptr<DrawQuad> tile_cmp = tile_in->Copy(
414 tile_in->shared_quad_state);
415
[email protected]4934d362012-11-22 22:04:53416 scoped_ptr<YUVVideoDrawQuad> yuvvideo_in =
417 YUVVideoDrawQuad::Create();
[email protected]cbe94b7a2013-11-13 11:03:37418 yuvvideo_in->SetAll(shared_state3_in.get(),
[email protected]4934d362012-11-22 22:04:53419 arbitrary_rect1,
[email protected]8e1da692013-10-12 17:11:30420 arbitrary_rect2_inside_rect1,
421 arbitrary_rect1_inside_rect1,
[email protected]4934d362012-11-22 22:04:53422 arbitrary_bool1,
423 arbitrary_sizef1,
[email protected]b7cfc632013-04-10 04:44:49424 arbitrary_resourceid1,
425 arbitrary_resourceid2,
[email protected]0402b2382013-06-07 21:50:54426 arbitrary_resourceid3,
427 arbitrary_resourceid4);
[email protected]4934d362012-11-22 22:04:53428 scoped_ptr<DrawQuad> yuvvideo_cmp = yuvvideo_in->Copy(
429 yuvvideo_in->shared_quad_state);
430
431 scoped_ptr<RenderPass> pass_in = RenderPass::Create();
432 pass_in->SetAll(arbitrary_id,
433 arbitrary_rect1,
434 arbitrary_rectf1,
435 arbitrary_matrix,
[email protected]fbc293322013-10-01 05:07:15436 arbitrary_bool1);
[email protected]4934d362012-11-22 22:04:53437
[email protected]ead39c52013-01-09 07:22:45438 pass_in->shared_quad_state_list.push_back(shared_state1_in.Pass());
439 pass_in->quad_list.push_back(checkerboard_in.PassAs<DrawQuad>());
440 pass_in->quad_list.push_back(debugborder_in.PassAs<DrawQuad>());
441 pass_in->quad_list.push_back(iosurface_in.PassAs<DrawQuad>());
442 pass_in->quad_list.push_back(renderpass_in.PassAs<DrawQuad>());
443 pass_in->shared_quad_state_list.push_back(shared_state2_in.Pass());
444 pass_in->shared_quad_state_list.push_back(shared_state3_in.Pass());
445 pass_in->quad_list.push_back(solidcolor_in.PassAs<DrawQuad>());
446 pass_in->quad_list.push_back(streamvideo_in.PassAs<DrawQuad>());
[email protected]78d30122014-01-17 06:32:36447 pass_in->quad_list.push_back(surface_in.PassAs<DrawQuad>());
[email protected]61df9d82013-01-30 02:32:42448 pass_in->quad_list.push_back(texture_in.PassAs<DrawQuad>());
449 pass_in->quad_list.push_back(tile_in.PassAs<DrawQuad>());
[email protected]ead39c52013-01-09 07:22:45450 pass_in->quad_list.push_back(yuvvideo_in.PassAs<DrawQuad>());
[email protected]4934d362012-11-22 22:04:53451
452 scoped_ptr<RenderPass> pass_cmp = RenderPass::Create();
453 pass_cmp->SetAll(arbitrary_id,
454 arbitrary_rect1,
455 arbitrary_rectf1,
456 arbitrary_matrix,
[email protected]fbc293322013-10-01 05:07:15457 arbitrary_bool1);
[email protected]4934d362012-11-22 22:04:53458
[email protected]ead39c52013-01-09 07:22:45459 pass_cmp->shared_quad_state_list.push_back(shared_state1_cmp.Pass());
460 pass_cmp->quad_list.push_back(checkerboard_cmp.PassAs<DrawQuad>());
461 pass_cmp->quad_list.push_back(debugborder_cmp.PassAs<DrawQuad>());
462 pass_cmp->quad_list.push_back(iosurface_cmp.PassAs<DrawQuad>());
463 pass_cmp->quad_list.push_back(renderpass_cmp.PassAs<DrawQuad>());
464 pass_cmp->shared_quad_state_list.push_back(shared_state2_cmp.Pass());
465 pass_cmp->shared_quad_state_list.push_back(shared_state3_cmp.Pass());
466 pass_cmp->quad_list.push_back(solidcolor_cmp.PassAs<DrawQuad>());
467 pass_cmp->quad_list.push_back(streamvideo_cmp.PassAs<DrawQuad>());
[email protected]78d30122014-01-17 06:32:36468 pass_cmp->quad_list.push_back(surface_cmp.PassAs<DrawQuad>());
[email protected]61df9d82013-01-30 02:32:42469 pass_cmp->quad_list.push_back(texture_cmp.PassAs<DrawQuad>());
470 pass_cmp->quad_list.push_back(tile_cmp.PassAs<DrawQuad>());
[email protected]ead39c52013-01-09 07:22:45471 pass_cmp->quad_list.push_back(yuvvideo_cmp.PassAs<DrawQuad>());
[email protected]4934d362012-11-22 22:04:53472
473 // Make sure the in and cmp RenderPasses match.
474 Compare(pass_cmp.get(), pass_in.get());
475 ASSERT_EQ(3u, pass_in->shared_quad_state_list.size());
[email protected]78d30122014-01-17 06:32:36476 ASSERT_EQ(10u, pass_in->quad_list.size());
[email protected]4934d362012-11-22 22:04:53477 for (size_t i = 0; i < 3; ++i) {
478 Compare(pass_cmp->shared_quad_state_list[i],
479 pass_in->shared_quad_state_list[i]);
480 }
[email protected]61df9d82013-01-30 02:32:42481 for (size_t i = 0; i < pass_in->quad_list.size(); ++i)
[email protected]4934d362012-11-22 22:04:53482 Compare(pass_cmp->quad_list[i], pass_in->quad_list[i]);
[email protected]61df9d82013-01-30 02:32:42483 for (size_t i = 1; i < pass_in->quad_list.size(); ++i) {
[email protected]4934d362012-11-22 22:04:53484 bool same_shared_quad_state_cmp =
485 pass_cmp->quad_list[i]->shared_quad_state ==
486 pass_cmp->quad_list[i - 1]->shared_quad_state;
487 bool same_shared_quad_state_in =
488 pass_in->quad_list[i]->shared_quad_state ==
489 pass_in->quad_list[i - 1]->shared_quad_state;
490 EXPECT_EQ(same_shared_quad_state_cmp, same_shared_quad_state_in);
491 }
492
[email protected]bf189f62012-12-18 03:42:11493 DelegatedFrameData frame_in;
[email protected]ead39c52013-01-09 07:22:45494 frame_in.render_pass_list.push_back(pass_in.Pass());
[email protected]4934d362012-11-22 22:04:53495
[email protected]bf189f62012-12-18 03:42:11496 IPC::ParamTraits<DelegatedFrameData>::Write(&msg, frame_in);
[email protected]bca159072012-12-04 00:52:44497
[email protected]bf189f62012-12-18 03:42:11498 DelegatedFrameData frame_out;
[email protected]4934d362012-11-22 22:04:53499 PickleIterator iter(msg);
[email protected]bf189f62012-12-18 03:42:11500 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg,
501 &iter, &frame_out));
[email protected]bca159072012-12-04 00:52:44502
[email protected]4934d362012-11-22 22:04:53503 // Make sure the out and cmp RenderPasses match.
[email protected]ead39c52013-01-09 07:22:45504 scoped_ptr<RenderPass> pass_out = frame_out.render_pass_list.take(
505 frame_out.render_pass_list.begin());
[email protected]4934d362012-11-22 22:04:53506 Compare(pass_cmp.get(), pass_out.get());
507 ASSERT_EQ(3u, pass_out->shared_quad_state_list.size());
[email protected]78d30122014-01-17 06:32:36508 ASSERT_EQ(10u, pass_out->quad_list.size());
[email protected]4934d362012-11-22 22:04:53509 for (size_t i = 0; i < 3; ++i) {
510 Compare(pass_cmp->shared_quad_state_list[i],
511 pass_out->shared_quad_state_list[i]);
512 }
[email protected]61df9d82013-01-30 02:32:42513 for (size_t i = 0; i < pass_out->quad_list.size(); ++i)
[email protected]4934d362012-11-22 22:04:53514 Compare(pass_cmp->quad_list[i], pass_out->quad_list[i]);
[email protected]61df9d82013-01-30 02:32:42515 for (size_t i = 1; i < pass_out->quad_list.size(); ++i) {
[email protected]4934d362012-11-22 22:04:53516 bool same_shared_quad_state_cmp =
517 pass_cmp->quad_list[i]->shared_quad_state ==
518 pass_cmp->quad_list[i - 1]->shared_quad_state;
519 bool same_shared_quad_state_out =
520 pass_out->quad_list[i]->shared_quad_state ==
521 pass_out->quad_list[i - 1]->shared_quad_state;
522 EXPECT_EQ(same_shared_quad_state_cmp, same_shared_quad_state_out);
523 }
524}
[email protected]bca159072012-12-04 00:52:44525
[email protected]cbe94b7a2013-11-13 11:03:37526TEST_F(CCMessagesTest, UnusedSharedQuadStates) {
527 scoped_ptr<CheckerboardDrawQuad> quad;
528
529 scoped_ptr<RenderPass> pass_in = RenderPass::Create();
530 pass_in->SetAll(RenderPass::Id(1, 1),
531 gfx::Rect(100, 100),
532 gfx::RectF(),
533 gfx::Transform(),
534 false);
535
536 // The first SharedQuadState is used.
537 scoped_ptr<SharedQuadState> shared_state1_in = SharedQuadState::Create();
[email protected]7bbeaf4e2013-11-26 10:27:22538 shared_state1_in->SetAll(gfx::Transform(),
539 gfx::Size(1, 1),
540 gfx::Rect(),
541 gfx::Rect(),
542 false,
543 1.f,
544 SkXfermode::kSrcOver_Mode);
[email protected]cbe94b7a2013-11-13 11:03:37545
546 quad = CheckerboardDrawQuad::Create();
547 quad->SetAll(shared_state1_in.get(),
548 gfx::Rect(10, 10),
549 gfx::Rect(10, 10),
550 gfx::Rect(10, 10),
551 false,
552 SK_ColorRED);
553 pass_in->quad_list.push_back(quad.PassAs<DrawQuad>());
554
555 // The second and third SharedQuadStates are not used.
556 scoped_ptr<SharedQuadState> shared_state2_in = SharedQuadState::Create();
[email protected]7bbeaf4e2013-11-26 10:27:22557 shared_state2_in->SetAll(gfx::Transform(),
558 gfx::Size(2, 2),
559 gfx::Rect(),
560 gfx::Rect(),
561 false,
562 1.f,
563 SkXfermode::kSrcOver_Mode);
[email protected]cbe94b7a2013-11-13 11:03:37564
565 scoped_ptr<SharedQuadState> shared_state3_in = SharedQuadState::Create();
[email protected]7bbeaf4e2013-11-26 10:27:22566 shared_state3_in->SetAll(gfx::Transform(),
567 gfx::Size(3, 3),
568 gfx::Rect(),
569 gfx::Rect(),
570 false,
571 1.f,
572 SkXfermode::kSrcOver_Mode);
[email protected]cbe94b7a2013-11-13 11:03:37573
574 // The fourth SharedQuadState is used.
575 scoped_ptr<SharedQuadState> shared_state4_in = SharedQuadState::Create();
[email protected]7bbeaf4e2013-11-26 10:27:22576 shared_state4_in->SetAll(gfx::Transform(),
577 gfx::Size(4, 4),
578 gfx::Rect(),
579 gfx::Rect(),
580 false,
581 1.f,
582 SkXfermode::kSrcOver_Mode);
[email protected]cbe94b7a2013-11-13 11:03:37583
584 quad = CheckerboardDrawQuad::Create();
585 quad->SetAll(shared_state4_in.get(),
586 gfx::Rect(10, 10),
587 gfx::Rect(10, 10),
588 gfx::Rect(10, 10),
589 false,
590 SK_ColorRED);
591 pass_in->quad_list.push_back(quad.PassAs<DrawQuad>());
592
593 // The fifth is not used again.
594 scoped_ptr<SharedQuadState> shared_state5_in = SharedQuadState::Create();
[email protected]7bbeaf4e2013-11-26 10:27:22595 shared_state5_in->SetAll(gfx::Transform(),
596 gfx::Size(5, 5),
597 gfx::Rect(),
598 gfx::Rect(),
599 false,
600 1.f,
601 SkXfermode::kSrcOver_Mode);
[email protected]cbe94b7a2013-11-13 11:03:37602
603 pass_in->shared_quad_state_list.push_back(shared_state1_in.Pass());
604 pass_in->shared_quad_state_list.push_back(shared_state2_in.Pass());
605 pass_in->shared_quad_state_list.push_back(shared_state3_in.Pass());
606 pass_in->shared_quad_state_list.push_back(shared_state4_in.Pass());
607 pass_in->shared_quad_state_list.push_back(shared_state5_in.Pass());
608
609 // 5 SharedQuadStates go in.
610 ASSERT_EQ(5u, pass_in->shared_quad_state_list.size());
611 ASSERT_EQ(2u, pass_in->quad_list.size());
612
613 DelegatedFrameData frame_in;
614 frame_in.render_pass_list.push_back(pass_in.Pass());
615
616 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
617 IPC::ParamTraits<DelegatedFrameData>::Write(&msg, frame_in);
618
619 DelegatedFrameData frame_out;
620 PickleIterator iter(msg);
621 EXPECT_TRUE(
622 IPC::ParamTraits<DelegatedFrameData>::Read(&msg, &iter, &frame_out));
623
624 scoped_ptr<RenderPass> pass_out =
625 frame_out.render_pass_list.take(frame_out.render_pass_list.begin());
626
627 // 2 SharedQuadStates come out. The first and fourth SharedQuadStates were
628 // used by quads, and so serialized. Others were not.
629 ASSERT_EQ(2u, pass_out->shared_quad_state_list.size());
630 ASSERT_EQ(2u, pass_out->quad_list.size());
631
632 EXPECT_EQ(gfx::Size(1, 1).ToString(),
633 pass_out->shared_quad_state_list[0]->content_bounds.ToString());
634 EXPECT_EQ(gfx::Size(4, 4).ToString(),
635 pass_out->shared_quad_state_list[1]->content_bounds.ToString());
636}
637
[email protected]bca159072012-12-04 00:52:44638TEST_F(CCMessagesTest, Resources) {
[email protected]753bb252013-11-04 22:28:12639 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
[email protected]bca159072012-12-04 00:52:44640 gfx::Size arbitrary_size(757, 1281);
[email protected]09831f7f2013-02-27 03:32:15641 unsigned int arbitrary_uint1 = 71234838;
642 unsigned int arbitrary_uint2 = 53589793;
[email protected]bca159072012-12-04 00:52:44643
644 GLbyte arbitrary_mailbox1[64] = {
645 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,
646 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,
647 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,
648 1, 2, 3, 4
649 };
650
651 GLbyte arbitrary_mailbox2[64] = {
652 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0,
653 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0,
654 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0,
655 0, 9, 8, 7
656 };
657
658 TransferableResource arbitrary_resource1;
659 arbitrary_resource1.id = 2178312;
[email protected]27a41fe2013-09-19 05:05:14660 arbitrary_resource1.format = cc::RGBA_8888;
[email protected]80189292013-02-28 01:59:36661 arbitrary_resource1.filter = 53;
[email protected]bca159072012-12-04 00:52:44662 arbitrary_resource1.size = gfx::Size(37189, 123123);
[email protected]df41e252014-02-03 23:39:50663 arbitrary_resource1.mailbox_holder.mailbox.SetName(arbitrary_mailbox1);
664 arbitrary_resource1.mailbox_holder.texture_target = GL_TEXTURE_2D;
665 arbitrary_resource1.mailbox_holder.sync_point = arbitrary_uint1;
[email protected]bca159072012-12-04 00:52:44666
667 TransferableResource arbitrary_resource2;
668 arbitrary_resource2.id = 789132;
[email protected]27a41fe2013-09-19 05:05:14669 arbitrary_resource2.format = cc::RGBA_4444;
[email protected]645a47f22013-09-26 05:42:32670 arbitrary_resource2.filter = 47;
[email protected]bca159072012-12-04 00:52:44671 arbitrary_resource2.size = gfx::Size(89123, 23789);
[email protected]df41e252014-02-03 23:39:50672 arbitrary_resource2.mailbox_holder.mailbox.SetName(arbitrary_mailbox2);
673 arbitrary_resource2.mailbox_holder.texture_target = GL_TEXTURE_EXTERNAL_OES;
674 arbitrary_resource2.mailbox_holder.sync_point = arbitrary_uint2;
[email protected]bca159072012-12-04 00:52:44675
[email protected]cb7d6492013-10-03 02:40:04676 scoped_ptr<RenderPass> renderpass_in = RenderPass::Create();
677 renderpass_in->SetNew(
678 RenderPass::Id(1, 1), gfx::Rect(), gfx::Rect(), gfx::Transform());
679
[email protected]bf189f62012-12-18 03:42:11680 DelegatedFrameData frame_in;
[email protected]09831f7f2013-02-27 03:32:15681 frame_in.resource_list.push_back(arbitrary_resource1);
682 frame_in.resource_list.push_back(arbitrary_resource2);
[email protected]cb7d6492013-10-03 02:40:04683 frame_in.render_pass_list.push_back(renderpass_in.Pass());
[email protected]bca159072012-12-04 00:52:44684
[email protected]bf189f62012-12-18 03:42:11685 IPC::ParamTraits<DelegatedFrameData>::Write(&msg, frame_in);
[email protected]bca159072012-12-04 00:52:44686
[email protected]bf189f62012-12-18 03:42:11687 DelegatedFrameData frame_out;
[email protected]bca159072012-12-04 00:52:44688 PickleIterator iter(msg);
[email protected]bf189f62012-12-18 03:42:11689 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg,
690 &iter, &frame_out));
[email protected]bca159072012-12-04 00:52:44691
[email protected]09831f7f2013-02-27 03:32:15692 ASSERT_EQ(2u, frame_out.resource_list.size());
693 Compare(arbitrary_resource1, frame_out.resource_list[0]);
694 Compare(arbitrary_resource2, frame_out.resource_list[1]);
[email protected]bca159072012-12-04 00:52:44695}
696
[email protected]032bfc42013-10-29 22:23:52697TEST_F(CCMessagesTest, LargestQuadType) {
698 size_t largest = 0;
699
700 bool done = false;
701 for (int i = 0; !done; ++i) {
702 switch (static_cast<DrawQuad::Material>(i)) {
703 case cc::DrawQuad::CHECKERBOARD:
704 largest = std::max(largest, sizeof(cc::CheckerboardDrawQuad));
705 break;
706 case cc::DrawQuad::DEBUG_BORDER:
707 largest = std::max(largest, sizeof(cc::DebugBorderDrawQuad));
708 break;
709 case cc::DrawQuad::IO_SURFACE_CONTENT:
710 largest = std::max(largest, sizeof(cc::IOSurfaceDrawQuad));
711 break;
712 case cc::DrawQuad::PICTURE_CONTENT:
713 largest = std::max(largest, sizeof(cc::PictureDrawQuad));
714 break;
715 case cc::DrawQuad::TEXTURE_CONTENT:
716 largest = std::max(largest, sizeof(cc::TextureDrawQuad));
717 break;
718 case cc::DrawQuad::RENDER_PASS:
719 largest = std::max(largest, sizeof(cc::RenderPassDrawQuad));
720 break;
721 case cc::DrawQuad::SOLID_COLOR:
722 largest = std::max(largest, sizeof(cc::SolidColorDrawQuad));
723 break;
[email protected]78d30122014-01-17 06:32:36724 case cc::DrawQuad::SURFACE_CONTENT:
725 largest = std::max(largest, sizeof(cc::SurfaceDrawQuad));
726 break;
[email protected]032bfc42013-10-29 22:23:52727 case cc::DrawQuad::TILED_CONTENT:
728 largest = std::max(largest, sizeof(cc::TileDrawQuad));
729 break;
730 case cc::DrawQuad::STREAM_VIDEO_CONTENT:
731 largest = std::max(largest, sizeof(cc::StreamVideoDrawQuad));
732 break;
733 case cc::DrawQuad::YUV_VIDEO_CONTENT:
734 largest = std::max(largest, sizeof(cc::YUVVideoDrawQuad));
735 break;
736 case cc::DrawQuad::INVALID:
737 break;
738 default:
739 done = true;
740 }
741 }
742
743 // Verify the largest DrawQuad type is RenderPassDrawQuad. If this ever
744 // changes, then the ReserveSizeForRenderPassWrite() method needs to be
745 // updated as well to use the new largest quad.
746 EXPECT_EQ(sizeof(RenderPassDrawQuad), largest);
747}
748
[email protected]bca159072012-12-04 00:52:44749} // namespace
750} // namespace content