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

Side by Side Diff: content/common/cc_messages_unittest.cc

Issue 21271002: Added SkImageFilter serialization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« content/common/cc_messages.cc ('K') | « content/common/cc_messages.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/cc_messages.h" 5 #include "content/common/cc_messages.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "ipc/ipc_message.h" 10 #include "ipc/ipc_message.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/skia/include/effects/SkBlurImageFilter.h"
12 13
13 using cc::CheckerboardDrawQuad; 14 using cc::CheckerboardDrawQuad;
14 using cc::DelegatedFrameData; 15 using cc::DelegatedFrameData;
15 using cc::DebugBorderDrawQuad; 16 using cc::DebugBorderDrawQuad;
16 using cc::DrawQuad; 17 using cc::DrawQuad;
17 using cc::FilterOperation; 18 using cc::FilterOperation;
18 using cc::FilterOperations; 19 using cc::FilterOperations;
19 using cc::IOSurfaceDrawQuad; 20 using cc::IOSurfaceDrawQuad;
20 using cc::PictureDrawQuad; 21 using cc::PictureDrawQuad;
21 using cc::RenderPass; 22 using cc::RenderPass;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 128 }
128 129
129 void Compare(const RenderPassDrawQuad* a, const RenderPassDrawQuad* b) { 130 void Compare(const RenderPassDrawQuad* a, const RenderPassDrawQuad* b) {
130 EXPECT_EQ(a->render_pass_id, b->render_pass_id); 131 EXPECT_EQ(a->render_pass_id, b->render_pass_id);
131 EXPECT_EQ(a->is_replica, b->is_replica); 132 EXPECT_EQ(a->is_replica, b->is_replica);
132 EXPECT_EQ(a->mask_resource_id, b->mask_resource_id); 133 EXPECT_EQ(a->mask_resource_id, b->mask_resource_id);
133 EXPECT_EQ(a->contents_changed_since_last_frame, 134 EXPECT_EQ(a->contents_changed_since_last_frame,
134 b->contents_changed_since_last_frame); 135 b->contents_changed_since_last_frame);
135 EXPECT_EQ(a->mask_uv_rect.ToString(), b->mask_uv_rect.ToString()); 136 EXPECT_EQ(a->mask_uv_rect.ToString(), b->mask_uv_rect.ToString());
136 EXPECT_EQ(a->filters, b->filters); 137 EXPECT_EQ(a->filters, b->filters);
137 EXPECT_EQ(a->filter, b->filter); 138 EXPECT_EQ(a->filter, b->filter);
piman 2013/07/30 19:57:35 Given that this compares by pointer, I assume this
sugoi1 2013/07/30 20:08:21 Oh yeah, missed that, I'll change the code.
138 EXPECT_EQ(a->background_filters, b->background_filters); 139 EXPECT_EQ(a->background_filters, b->background_filters);
139 } 140 }
140 141
141 void Compare(const SolidColorDrawQuad* a, const SolidColorDrawQuad* b) { 142 void Compare(const SolidColorDrawQuad* a, const SolidColorDrawQuad* b) {
142 EXPECT_EQ(a->color, b->color); 143 EXPECT_EQ(a->color, b->color);
143 EXPECT_EQ(a->force_anti_aliasing_off, b->force_anti_aliasing_off); 144 EXPECT_EQ(a->force_anti_aliasing_off, b->force_anti_aliasing_off);
144 } 145 }
145 146
146 void Compare(const StreamVideoDrawQuad* a, const StreamVideoDrawQuad* b) { 147 void Compare(const StreamVideoDrawQuad* a, const StreamVideoDrawQuad* b) {
147 EXPECT_EQ(a->resource_id, b->resource_id); 148 EXPECT_EQ(a->resource_id, b->resource_id);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 bool arbitrary_bool3 = true; 214 bool arbitrary_bool3 = true;
214 int arbitrary_int = 5; 215 int arbitrary_int = 5;
215 SkColor arbitrary_color = SkColorSetARGB(25, 36, 47, 58); 216 SkColor arbitrary_color = SkColorSetARGB(25, 36, 47, 58);
216 IOSurfaceDrawQuad::Orientation arbitrary_orientation = 217 IOSurfaceDrawQuad::Orientation arbitrary_orientation =
217 IOSurfaceDrawQuad::UNFLIPPED; 218 IOSurfaceDrawQuad::UNFLIPPED;
218 RenderPass::Id arbitrary_id(10, 14); 219 RenderPass::Id arbitrary_id(10, 14);
219 ResourceProvider::ResourceId arbitrary_resourceid1 = 55; 220 ResourceProvider::ResourceId arbitrary_resourceid1 = 55;
220 ResourceProvider::ResourceId arbitrary_resourceid2 = 47; 221 ResourceProvider::ResourceId arbitrary_resourceid2 = 47;
221 ResourceProvider::ResourceId arbitrary_resourceid3 = 23; 222 ResourceProvider::ResourceId arbitrary_resourceid3 = 23;
222 ResourceProvider::ResourceId arbitrary_resourceid4 = 16; 223 ResourceProvider::ResourceId arbitrary_resourceid4 = 16;
224 SkScalar arbitrary_sigma = SkFloatToScalar(2.0f);
223 225
224 FilterOperations arbitrary_filters1; 226 FilterOperations arbitrary_filters1;
225 arbitrary_filters1.Append(FilterOperation::CreateGrayscaleFilter( 227 arbitrary_filters1.Append(FilterOperation::CreateGrayscaleFilter(
226 arbitrary_float1)); 228 arbitrary_float1));
227 229
228 FilterOperations arbitrary_filters2; 230 FilterOperations arbitrary_filters2;
229 arbitrary_filters2.Append(FilterOperation::CreateBrightnessFilter( 231 arbitrary_filters2.Append(FilterOperation::CreateBrightnessFilter(
230 arbitrary_float2)); 232 arbitrary_float2));
231 233
232 // TODO(danakj): filter is not serialized. 234 skia::RefPtr<SkImageFilter> arbitrary_filter = skia::AdoptRef(
233 skia::RefPtr<SkImageFilter> arbitrary_filter; 235 new SkBlurImageFilter(arbitrary_sigma, arbitrary_sigma));
234 236
235 scoped_ptr<SharedQuadState> shared_state1_in = SharedQuadState::Create(); 237 scoped_ptr<SharedQuadState> shared_state1_in = SharedQuadState::Create();
236 shared_state1_in->SetAll(arbitrary_matrix, 238 shared_state1_in->SetAll(arbitrary_matrix,
237 arbitrary_size1, 239 arbitrary_size1,
238 arbitrary_rect1, 240 arbitrary_rect1,
239 arbitrary_rect2, 241 arbitrary_rect2,
240 arbitrary_bool1, 242 arbitrary_bool1,
241 arbitrary_float1); 243 arbitrary_float1);
242 scoped_ptr<SharedQuadState> shared_state1_cmp = shared_state1_in->Copy(); 244 scoped_ptr<SharedQuadState> shared_state1_cmp = shared_state1_in->Copy();
243 245
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 arbitrary_rect1, 285 arbitrary_rect1,
284 arbitrary_rect2, 286 arbitrary_rect2,
285 arbitrary_rect3, 287 arbitrary_rect3,
286 arbitrary_bool1, 288 arbitrary_bool1,
287 arbitrary_id, 289 arbitrary_id,
288 arbitrary_bool2, 290 arbitrary_bool2,
289 arbitrary_resourceid2, 291 arbitrary_resourceid2,
290 arbitrary_rect1, 292 arbitrary_rect1,
291 arbitrary_rectf1, 293 arbitrary_rectf1,
292 arbitrary_filters1, 294 arbitrary_filters1,
293 arbitrary_filter, // TODO(piman): not serialized. 295 arbitrary_filter,
294 arbitrary_filters2); 296 arbitrary_filters2);
295 scoped_ptr<RenderPassDrawQuad> renderpass_cmp = renderpass_in->Copy( 297 scoped_ptr<RenderPassDrawQuad> renderpass_cmp = renderpass_in->Copy(
296 renderpass_in->shared_quad_state, renderpass_in->render_pass_id); 298 renderpass_in->shared_quad_state, renderpass_in->render_pass_id);
297 299
298 scoped_ptr<SharedQuadState> shared_state2_in = SharedQuadState::Create(); 300 scoped_ptr<SharedQuadState> shared_state2_in = SharedQuadState::Create();
299 shared_state2_in->SetAll(arbitrary_matrix, 301 shared_state2_in->SetAll(arbitrary_matrix,
300 arbitrary_size2, 302 arbitrary_size2,
301 arbitrary_rect2, 303 arbitrary_rect2,
302 arbitrary_rect3, 304 arbitrary_rect3,
303 arbitrary_bool1, 305 arbitrary_bool1,
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg, 525 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg,
524 &iter, &frame_out)); 526 &iter, &frame_out));
525 527
526 ASSERT_EQ(2u, frame_out.resource_list.size()); 528 ASSERT_EQ(2u, frame_out.resource_list.size());
527 Compare(arbitrary_resource1, frame_out.resource_list[0]); 529 Compare(arbitrary_resource1, frame_out.resource_list[0]);
528 Compare(arbitrary_resource2, frame_out.resource_list[1]); 530 Compare(arbitrary_resource2, frame_out.resource_list[1]);
529 } 531 }
530 532
531 } // namespace 533 } // namespace
532 } // namespace content 534 } // namespace content
OLDNEW
« content/common/cc_messages.cc ('K') | « content/common/cc_messages.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698