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

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

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for landing Created 8 years 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
« no previous file with comments | « content/common/cc_messages.cc ('k') | ui/compositor/layer.cc » ('j') | 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 "ipc/ipc_message.h" 9 #include "ipc/ipc_message.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 using cc::CheckerboardDrawQuad; 12 using cc::CheckerboardDrawQuad;
13 using cc::DebugBorderDrawQuad; 13 using cc::DebugBorderDrawQuad;
14 using cc::DrawQuad; 14 using cc::DrawQuad;
15 using cc::IOSurfaceDrawQuad; 15 using cc::IOSurfaceDrawQuad;
16 using cc::RenderPass; 16 using cc::RenderPass;
17 using cc::RenderPassDrawQuad; 17 using cc::RenderPassDrawQuad;
18 using cc::ResourceProvider; 18 using cc::ResourceProvider;
19 using cc::SharedQuadState; 19 using cc::SharedQuadState;
20 using cc::SolidColorDrawQuad; 20 using cc::SolidColorDrawQuad;
21 using cc::TextureDrawQuad; 21 using cc::TextureDrawQuad;
22 using cc::TileDrawQuad; 22 using cc::TileDrawQuad;
23 using cc::StreamVideoDrawQuad; 23 using cc::StreamVideoDrawQuad;
24 using cc::VideoLayerImpl; 24 using cc::VideoLayerImpl;
25 using cc::YUVVideoDrawQuad; 25 using cc::YUVVideoDrawQuad;
26 using gfx::Transform;
26 using WebKit::WebFilterOperation; 27 using WebKit::WebFilterOperation;
27 using WebKit::WebFilterOperations; 28 using WebKit::WebFilterOperations;
28 using WebKit::WebTransformationMatrix;
29 29
30 class CCMessagesTest : public testing::Test { 30 class CCMessagesTest : public testing::Test {
31 protected: 31 protected:
32 void Compare(const RenderPass* a, const RenderPass* b) { 32 void Compare(const RenderPass* a, const RenderPass* b) {
33 EXPECT_EQ(a->id, b->id); 33 EXPECT_EQ(a->id, b->id);
34 EXPECT_EQ(a->output_rect.ToString(), b->output_rect.ToString()); 34 EXPECT_EQ(a->output_rect.ToString(), b->output_rect.ToString());
35 EXPECT_EQ(a->damage_rect.ToString(), b->damage_rect.ToString()); 35 EXPECT_EQ(a->damage_rect.ToString(), b->damage_rect.ToString());
36 EXPECT_EQ(a->transform_to_root_target, b->transform_to_root_target); 36 EXPECT_EQ(a->transform_to_root_target, b->transform_to_root_target);
37 EXPECT_EQ(a->has_transparent_background, b->has_transparent_background); 37 EXPECT_EQ(a->has_transparent_background, b->has_transparent_background);
38 EXPECT_EQ(a->has_occlusion_from_outside_target_surface, 38 EXPECT_EQ(a->has_occlusion_from_outside_target_surface,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 EXPECT_EQ(a->u_plane.format, b->u_plane.format); 166 EXPECT_EQ(a->u_plane.format, b->u_plane.format);
167 EXPECT_EQ(a->v_plane.resourceId, b->v_plane.resourceId); 167 EXPECT_EQ(a->v_plane.resourceId, b->v_plane.resourceId);
168 EXPECT_EQ(a->v_plane.size.ToString(), b->v_plane.size.ToString()); 168 EXPECT_EQ(a->v_plane.size.ToString(), b->v_plane.size.ToString());
169 EXPECT_EQ(a->v_plane.format, b->v_plane.format); 169 EXPECT_EQ(a->v_plane.format, b->v_plane.format);
170 } 170 }
171 }; 171 };
172 172
173 TEST_F(CCMessagesTest, AllQuads) { 173 TEST_F(CCMessagesTest, AllQuads) {
174 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); 174 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
175 175
176 WebTransformationMatrix arbitrary_matrix; 176 Transform arbitrary_matrix;
177 arbitrary_matrix.scale(3); 177 arbitrary_matrix.Scale(3, 3);
178 arbitrary_matrix.translate(-5, 20); 178 arbitrary_matrix.Translate(-5, 20);
179 arbitrary_matrix.rotate(15); 179 arbitrary_matrix.Rotate(15);
180 gfx::Rect arbitrary_rect1(-5, 9, 3, 15); 180 gfx::Rect arbitrary_rect1(-5, 9, 3, 15);
181 gfx::Rect arbitrary_rect2(40, 23, 11, 7); 181 gfx::Rect arbitrary_rect2(40, 23, 11, 7);
182 gfx::Rect arbitrary_rect3(7, -53, 22, 19); 182 gfx::Rect arbitrary_rect3(7, -53, 22, 19);
183 gfx::Size arbitrary_size1(15, 19); 183 gfx::Size arbitrary_size1(15, 19);
184 gfx::Size arbitrary_size2(3, 99); 184 gfx::Size arbitrary_size2(3, 99);
185 gfx::Size arbitrary_size3(75, 1281); 185 gfx::Size arbitrary_size3(75, 1281);
186 gfx::RectF arbitrary_rectf1(4.2f, -922.1f, 15.6f, 29.5f); 186 gfx::RectF arbitrary_rectf1(4.2f, -922.1f, 15.6f, 29.5f);
187 gfx::SizeF arbitrary_sizef1(15.2f, 104.6f); 187 gfx::SizeF arbitrary_sizef1(15.2f, 104.6f);
188 float arbitrary_float1 = 0.7f; 188 float arbitrary_float1 = 0.7f;
189 float arbitrary_float2 = 0.3f; 189 float arbitrary_float2 = 0.3f;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 for (size_t i = 1; i < 7; ++i) { 422 for (size_t i = 1; i < 7; ++i) {
423 bool same_shared_quad_state_cmp = 423 bool same_shared_quad_state_cmp =
424 pass_cmp->quad_list[i]->shared_quad_state == 424 pass_cmp->quad_list[i]->shared_quad_state ==
425 pass_cmp->quad_list[i - 1]->shared_quad_state; 425 pass_cmp->quad_list[i - 1]->shared_quad_state;
426 bool same_shared_quad_state_out = 426 bool same_shared_quad_state_out =
427 pass_out->quad_list[i]->shared_quad_state == 427 pass_out->quad_list[i]->shared_quad_state ==
428 pass_out->quad_list[i - 1]->shared_quad_state; 428 pass_out->quad_list[i - 1]->shared_quad_state;
429 EXPECT_EQ(same_shared_quad_state_cmp, same_shared_quad_state_out); 429 EXPECT_EQ(same_shared_quad_state_cmp, same_shared_quad_state_out);
430 } 430 }
431 } 431 }
OLDNEW
« no previous file with comments | « content/common/cc_messages.cc ('k') | ui/compositor/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698