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

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

Issue 11316128: Send compositor frame IPC with metadata. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix compile errors on mac/win 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
« no previous file with comments | « content/common/cc_messages.cc ('k') | content/common/view_messages.h » ('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 "cc/compositor_frame.h" 9 #include "cc/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 12
13 using cc::CheckerboardDrawQuad; 13 using cc::CheckerboardDrawQuad;
14 using cc::CompositorFrame; 14 using cc::DelegatedFrameData;
15 using cc::DebugBorderDrawQuad; 15 using cc::DebugBorderDrawQuad;
16 using cc::DrawQuad; 16 using cc::DrawQuad;
17 using cc::IOSurfaceDrawQuad; 17 using cc::IOSurfaceDrawQuad;
18 using cc::RenderPass; 18 using cc::RenderPass;
19 using cc::RenderPassDrawQuad; 19 using cc::RenderPassDrawQuad;
20 using cc::ResourceProvider; 20 using cc::ResourceProvider;
21 using cc::SharedQuadState; 21 using cc::SharedQuadState;
22 using cc::SolidColorDrawQuad; 22 using cc::SolidColorDrawQuad;
23 using cc::TextureDrawQuad; 23 using cc::TextureDrawQuad;
24 using cc::TileDrawQuad; 24 using cc::TileDrawQuad;
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 for (size_t i = 1; i < 7; ++i) { 406 for (size_t i = 1; i < 7; ++i) {
407 bool same_shared_quad_state_cmp = 407 bool same_shared_quad_state_cmp =
408 pass_cmp->quad_list[i]->shared_quad_state == 408 pass_cmp->quad_list[i]->shared_quad_state ==
409 pass_cmp->quad_list[i - 1]->shared_quad_state; 409 pass_cmp->quad_list[i - 1]->shared_quad_state;
410 bool same_shared_quad_state_in = 410 bool same_shared_quad_state_in =
411 pass_in->quad_list[i]->shared_quad_state == 411 pass_in->quad_list[i]->shared_quad_state ==
412 pass_in->quad_list[i - 1]->shared_quad_state; 412 pass_in->quad_list[i - 1]->shared_quad_state;
413 EXPECT_EQ(same_shared_quad_state_cmp, same_shared_quad_state_in); 413 EXPECT_EQ(same_shared_quad_state_cmp, same_shared_quad_state_in);
414 } 414 }
415 415
416 CompositorFrame frame_in; 416 DelegatedFrameData frame_in;
417 frame_in.size = arbitrary_size1; 417 frame_in.size = arbitrary_size1;
418 frame_in.render_pass_list.append(pass_in.Pass()); 418 frame_in.render_pass_list.append(pass_in.Pass());
419 419
420 IPC::ParamTraits<CompositorFrame>::Write(&msg, frame_in); 420 IPC::ParamTraits<DelegatedFrameData>::Write(&msg, frame_in);
421 421
422 CompositorFrame frame_out; 422 DelegatedFrameData frame_out;
423 PickleIterator iter(msg); 423 PickleIterator iter(msg);
424 EXPECT_TRUE(IPC::ParamTraits<CompositorFrame>::Read(&msg, &iter, &frame_out)); 424 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg,
425 &iter, &frame_out));
425 426
426 EXPECT_EQ(arbitrary_size1, frame_out.size); 427 EXPECT_EQ(arbitrary_size1, frame_out.size);
427 428
428 // Make sure the out and cmp RenderPasses match. 429 // Make sure the out and cmp RenderPasses match.
429 scoped_ptr<RenderPass> pass_out = frame_out.render_pass_list.take(0); 430 scoped_ptr<RenderPass> pass_out = frame_out.render_pass_list.take(0);
430 Compare(pass_cmp.get(), pass_out.get()); 431 Compare(pass_cmp.get(), pass_out.get());
431 ASSERT_EQ(3u, pass_out->shared_quad_state_list.size()); 432 ASSERT_EQ(3u, pass_out->shared_quad_state_list.size());
432 ASSERT_EQ(7u, pass_out->quad_list.size()); 433 ASSERT_EQ(7u, pass_out->quad_list.size());
433 for (size_t i = 0; i < 3; ++i) { 434 for (size_t i = 0; i < 3; ++i) {
434 Compare(pass_cmp->shared_quad_state_list[i], 435 Compare(pass_cmp->shared_quad_state_list[i],
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 arbitrary_resource1.format = 7; 472 arbitrary_resource1.format = 7;
472 arbitrary_resource1.size = gfx::Size(37189, 123123); 473 arbitrary_resource1.size = gfx::Size(37189, 123123);
473 arbitrary_resource1.mailbox.setName(arbitrary_mailbox1); 474 arbitrary_resource1.mailbox.setName(arbitrary_mailbox1);
474 475
475 TransferableResource arbitrary_resource2; 476 TransferableResource arbitrary_resource2;
476 arbitrary_resource2.id = 789132; 477 arbitrary_resource2.id = 789132;
477 arbitrary_resource2.format = 30; 478 arbitrary_resource2.format = 30;
478 arbitrary_resource2.size = gfx::Size(89123, 23789); 479 arbitrary_resource2.size = gfx::Size(89123, 23789);
479 arbitrary_resource2.mailbox.setName(arbitrary_mailbox2); 480 arbitrary_resource2.mailbox.setName(arbitrary_mailbox2);
480 481
481 CompositorFrame frame_in; 482 DelegatedFrameData frame_in;
482 frame_in.size = arbitrary_size; 483 frame_in.size = arbitrary_size;
483 484
484 frame_in.resource_list.sync_point = arbitrary_uint; 485 frame_in.resource_list.sync_point = arbitrary_uint;
485 frame_in.resource_list.resources.push_back(arbitrary_resource1); 486 frame_in.resource_list.resources.push_back(arbitrary_resource1);
486 frame_in.resource_list.resources.push_back(arbitrary_resource2); 487 frame_in.resource_list.resources.push_back(arbitrary_resource2);
487 488
488 IPC::ParamTraits<CompositorFrame>::Write(&msg, frame_in); 489 IPC::ParamTraits<DelegatedFrameData>::Write(&msg, frame_in);
489 490
490 CompositorFrame frame_out; 491 DelegatedFrameData frame_out;
491 PickleIterator iter(msg); 492 PickleIterator iter(msg);
492 EXPECT_TRUE(IPC::ParamTraits<CompositorFrame>::Read(&msg, &iter, &frame_out)); 493 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg,
494 &iter, &frame_out));
493 495
494 EXPECT_EQ(arbitrary_size.ToString(), frame_out.size.ToString()); 496 EXPECT_EQ(arbitrary_size.ToString(), frame_out.size.ToString());
495 EXPECT_EQ(arbitrary_uint, frame_out.resource_list.sync_point); 497 EXPECT_EQ(arbitrary_uint, frame_out.resource_list.sync_point);
496 498
497 EXPECT_EQ(2u, frame_out.resource_list.resources.size()); 499 EXPECT_EQ(2u, frame_out.resource_list.resources.size());
498 Compare(arbitrary_resource1, frame_out.resource_list.resources[0]); 500 Compare(arbitrary_resource1, frame_out.resource_list.resources[0]);
499 Compare(arbitrary_resource2, frame_out.resource_list.resources[1]); 501 Compare(arbitrary_resource2, frame_out.resource_list.resources[1]);
500 } 502 }
501 503
502 } // namespace 504 } // namespace
503 } // namespace content 505 } // namespace content
OLDNEW
« no previous file with comments | « content/common/cc_messages.cc ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698