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

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

Issue 12335088: Move sync point from TransferResourceList to individual TransferResources (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 7 years, 10 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
« no previous file with comments | « content/common/cc_messages.h ('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/compositor_frame.h" 9 #include "cc/compositor_frame.h"
10 #include "ipc/ipc_message.h" 10 #include "ipc/ipc_message.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 EXPECT_EQ(a->u_plane.resourceId, b->u_plane.resourceId); 171 EXPECT_EQ(a->u_plane.resourceId, b->u_plane.resourceId);
172 EXPECT_EQ(a->u_plane.size.ToString(), b->u_plane.size.ToString()); 172 EXPECT_EQ(a->u_plane.size.ToString(), b->u_plane.size.ToString());
173 EXPECT_EQ(a->u_plane.format, b->u_plane.format); 173 EXPECT_EQ(a->u_plane.format, b->u_plane.format);
174 EXPECT_EQ(a->v_plane.resourceId, b->v_plane.resourceId); 174 EXPECT_EQ(a->v_plane.resourceId, b->v_plane.resourceId);
175 EXPECT_EQ(a->v_plane.size.ToString(), b->v_plane.size.ToString()); 175 EXPECT_EQ(a->v_plane.size.ToString(), b->v_plane.size.ToString());
176 EXPECT_EQ(a->v_plane.format, b->v_plane.format); 176 EXPECT_EQ(a->v_plane.format, b->v_plane.format);
177 } 177 }
178 178
179 void Compare(const TransferableResource& a, const TransferableResource& b) { 179 void Compare(const TransferableResource& a, const TransferableResource& b) {
180 EXPECT_EQ(a.id, b.id); 180 EXPECT_EQ(a.id, b.id);
181 EXPECT_EQ(a.sync_point, b.sync_point);
181 EXPECT_EQ(a.format, b.format); 182 EXPECT_EQ(a.format, b.format);
182 EXPECT_EQ(a.size.ToString(), b.size.ToString()); 183 EXPECT_EQ(a.size.ToString(), b.size.ToString());
183 for (size_t i = 0; i < arraysize(a.mailbox.name); ++i) 184 for (size_t i = 0; i < arraysize(a.mailbox.name); ++i)
184 EXPECT_EQ(a.mailbox.name[i], b.mailbox.name[i]); 185 EXPECT_EQ(a.mailbox.name[i], b.mailbox.name[i]);
185 } 186 }
186 }; 187 };
187 188
188 TEST_F(CCMessagesTest, AllQuads) { 189 TEST_F(CCMessagesTest, AllQuads) {
189 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); 190 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
190 191
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 bool same_shared_quad_state_out = 484 bool same_shared_quad_state_out =
484 pass_out->quad_list[i]->shared_quad_state == 485 pass_out->quad_list[i]->shared_quad_state ==
485 pass_out->quad_list[i - 1]->shared_quad_state; 486 pass_out->quad_list[i - 1]->shared_quad_state;
486 EXPECT_EQ(same_shared_quad_state_cmp, same_shared_quad_state_out); 487 EXPECT_EQ(same_shared_quad_state_cmp, same_shared_quad_state_out);
487 } 488 }
488 } 489 }
489 490
490 TEST_F(CCMessagesTest, Resources) { 491 TEST_F(CCMessagesTest, Resources) {
491 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); 492 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
492 gfx::Size arbitrary_size(757, 1281); 493 gfx::Size arbitrary_size(757, 1281);
493 unsigned int arbitrary_uint = 71234838; 494 unsigned int arbitrary_uint1 = 71234838;
495 unsigned int arbitrary_uint2 = 53589793;
494 496
495 GLbyte arbitrary_mailbox1[64] = { 497 GLbyte arbitrary_mailbox1[64] = {
496 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 498 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,
497 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 499 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,
498 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 500 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,
499 1, 2, 3, 4 501 1, 2, 3, 4
500 }; 502 };
501 503
502 GLbyte arbitrary_mailbox2[64] = { 504 GLbyte arbitrary_mailbox2[64] = {
503 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 505 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0,
504 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 506 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0,
505 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 507 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0,
506 0, 9, 8, 7 508 0, 9, 8, 7
507 }; 509 };
508 510
509 TransferableResource arbitrary_resource1; 511 TransferableResource arbitrary_resource1;
510 arbitrary_resource1.id = 2178312; 512 arbitrary_resource1.id = 2178312;
513 arbitrary_resource1.sync_point = arbitrary_uint1;
511 arbitrary_resource1.format = 7; 514 arbitrary_resource1.format = 7;
512 arbitrary_resource1.size = gfx::Size(37189, 123123); 515 arbitrary_resource1.size = gfx::Size(37189, 123123);
513 arbitrary_resource1.mailbox.setName(arbitrary_mailbox1); 516 arbitrary_resource1.mailbox.setName(arbitrary_mailbox1);
514 517
515 TransferableResource arbitrary_resource2; 518 TransferableResource arbitrary_resource2;
516 arbitrary_resource2.id = 789132; 519 arbitrary_resource2.id = 789132;
520 arbitrary_resource1.sync_point = arbitrary_uint2;
517 arbitrary_resource2.format = 30; 521 arbitrary_resource2.format = 30;
518 arbitrary_resource2.size = gfx::Size(89123, 23789); 522 arbitrary_resource2.size = gfx::Size(89123, 23789);
519 arbitrary_resource2.mailbox.setName(arbitrary_mailbox2); 523 arbitrary_resource2.mailbox.setName(arbitrary_mailbox2);
520 524
521 DelegatedFrameData frame_in; 525 DelegatedFrameData frame_in;
522 frame_in.resource_list.sync_point = arbitrary_uint; 526 frame_in.resource_list.push_back(arbitrary_resource1);
523 frame_in.resource_list.resources.push_back(arbitrary_resource1); 527 frame_in.resource_list.push_back(arbitrary_resource2);
524 frame_in.resource_list.resources.push_back(arbitrary_resource2);
525 528
526 IPC::ParamTraits<DelegatedFrameData>::Write(&msg, frame_in); 529 IPC::ParamTraits<DelegatedFrameData>::Write(&msg, frame_in);
527 530
528 DelegatedFrameData frame_out; 531 DelegatedFrameData frame_out;
529 PickleIterator iter(msg); 532 PickleIterator iter(msg);
530 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg, 533 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg,
531 &iter, &frame_out)); 534 &iter, &frame_out));
532 535
533 EXPECT_EQ(arbitrary_uint, frame_out.resource_list.sync_point); 536 ASSERT_EQ(2u, frame_out.resource_list.size());
534 537 Compare(arbitrary_resource1, frame_out.resource_list[0]);
535 EXPECT_EQ(2u, frame_out.resource_list.resources.size()); 538 Compare(arbitrary_resource2, frame_out.resource_list[1]);
536 Compare(arbitrary_resource1, frame_out.resource_list.resources[0]);
537 Compare(arbitrary_resource2, frame_out.resource_list.resources[1]);
538 } 539 }
539 540
540 } // namespace 541 } // namespace
541 } // namespace content 542 } // namespace content
OLDNEW
« no previous file with comments | « content/common/cc_messages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698