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

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

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Folded sync_point into sync_tokens Created 5 years, 1 month 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
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 <algorithm> 9 #include <algorithm>
10 10
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 void Compare(const TransferableResource& a, const TransferableResource& b) { 205 void Compare(const TransferableResource& a, const TransferableResource& b) {
206 EXPECT_EQ(a.id, b.id); 206 EXPECT_EQ(a.id, b.id);
207 EXPECT_EQ(a.format, b.format); 207 EXPECT_EQ(a.format, b.format);
208 EXPECT_EQ(a.filter, b.filter); 208 EXPECT_EQ(a.filter, b.filter);
209 EXPECT_EQ(a.size.ToString(), b.size.ToString()); 209 EXPECT_EQ(a.size.ToString(), b.size.ToString());
210 for (size_t i = 0; i < arraysize(a.mailbox_holder.mailbox.name); ++i) { 210 for (size_t i = 0; i < arraysize(a.mailbox_holder.mailbox.name); ++i) {
211 EXPECT_EQ(a.mailbox_holder.mailbox.name[i], 211 EXPECT_EQ(a.mailbox_holder.mailbox.name[i],
212 b.mailbox_holder.mailbox.name[i]); 212 b.mailbox_holder.mailbox.name[i]);
213 } 213 }
214 EXPECT_EQ(a.mailbox_holder.texture_target, b.mailbox_holder.texture_target); 214 EXPECT_EQ(a.mailbox_holder.texture_target, b.mailbox_holder.texture_target);
215 EXPECT_EQ(a.mailbox_holder.sync_point, b.mailbox_holder.sync_point); 215 EXPECT_EQ(a.mailbox_holder.sync_token, b.mailbox_holder.sync_token);
216 EXPECT_EQ(a.is_overlay_candidate, b.is_overlay_candidate); 216 EXPECT_EQ(a.is_overlay_candidate, b.is_overlay_candidate);
217 } 217 }
218 }; 218 };
219 219
220 TEST_F(CCMessagesTest, AllQuads) { 220 TEST_F(CCMessagesTest, AllQuads) {
221 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); 221 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
222 222
223 Transform arbitrary_matrix1; 223 Transform arbitrary_matrix1;
224 arbitrary_matrix1.Scale(3, 3); 224 arbitrary_matrix1.Scale(3, 3);
225 arbitrary_matrix1.Translate(-5, 20); 225 arbitrary_matrix1.Translate(-5, 20);
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 EXPECT_EQ(gfx::Size(4, 4).ToString(), 614 EXPECT_EQ(gfx::Size(4, 4).ToString(),
615 pass_out->shared_quad_state_list.ElementAt(1) 615 pass_out->shared_quad_state_list.ElementAt(1)
616 ->quad_layer_bounds.ToString()); 616 ->quad_layer_bounds.ToString());
617 } 617 }
618 618
619 TEST_F(CCMessagesTest, Resources) { 619 TEST_F(CCMessagesTest, Resources) {
620 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); 620 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
621 gfx::Size arbitrary_size(757, 1281); 621 gfx::Size arbitrary_size(757, 1281);
622 unsigned int arbitrary_uint1 = 71234838; 622 unsigned int arbitrary_uint1 = 71234838;
623 unsigned int arbitrary_uint2 = 53589793; 623 unsigned int arbitrary_uint2 = 53589793;
624 gpu::SyncToken arbitrary_token1(arbitrary_uint1);
625 gpu::SyncToken arbitrary_token2(arbitrary_uint2);
624 626
625 GLbyte arbitrary_mailbox1[GL_MAILBOX_SIZE_CHROMIUM] = { 627 GLbyte arbitrary_mailbox1[GL_MAILBOX_SIZE_CHROMIUM] = {
626 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 628 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2,
627 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 629 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4,
628 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4}; 630 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4};
629 631
630 GLbyte arbitrary_mailbox2[GL_MAILBOX_SIZE_CHROMIUM] = { 632 GLbyte arbitrary_mailbox2[GL_MAILBOX_SIZE_CHROMIUM] = {
631 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 0, 9, 633 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 0, 9,
632 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 0, 9, 8, 7, 634 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 0, 9, 8, 7,
633 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 0, 9, 8, 7}; 635 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 0, 9, 8, 7};
634 636
635 TransferableResource arbitrary_resource1; 637 TransferableResource arbitrary_resource1;
636 arbitrary_resource1.id = 2178312; 638 arbitrary_resource1.id = 2178312;
637 arbitrary_resource1.format = cc::RGBA_8888; 639 arbitrary_resource1.format = cc::RGBA_8888;
638 arbitrary_resource1.filter = 53; 640 arbitrary_resource1.filter = 53;
639 arbitrary_resource1.size = gfx::Size(37189, 123123); 641 arbitrary_resource1.size = gfx::Size(37189, 123123);
640 arbitrary_resource1.mailbox_holder.mailbox.SetName(arbitrary_mailbox1); 642 arbitrary_resource1.mailbox_holder.mailbox.SetName(arbitrary_mailbox1);
641 arbitrary_resource1.mailbox_holder.texture_target = GL_TEXTURE_2D; 643 arbitrary_resource1.mailbox_holder.texture_target = GL_TEXTURE_2D;
642 arbitrary_resource1.mailbox_holder.sync_point = arbitrary_uint1; 644 arbitrary_resource1.mailbox_holder.sync_token = arbitrary_token1;
643 arbitrary_resource1.is_overlay_candidate = true; 645 arbitrary_resource1.is_overlay_candidate = true;
644 646
645 TransferableResource arbitrary_resource2; 647 TransferableResource arbitrary_resource2;
646 arbitrary_resource2.id = 789132; 648 arbitrary_resource2.id = 789132;
647 arbitrary_resource2.format = cc::RGBA_4444; 649 arbitrary_resource2.format = cc::RGBA_4444;
648 arbitrary_resource2.filter = 47; 650 arbitrary_resource2.filter = 47;
649 arbitrary_resource2.size = gfx::Size(89123, 23789); 651 arbitrary_resource2.size = gfx::Size(89123, 23789);
650 arbitrary_resource2.mailbox_holder.mailbox.SetName(arbitrary_mailbox2); 652 arbitrary_resource2.mailbox_holder.mailbox.SetName(arbitrary_mailbox2);
651 arbitrary_resource2.mailbox_holder.texture_target = GL_TEXTURE_EXTERNAL_OES; 653 arbitrary_resource2.mailbox_holder.texture_target = GL_TEXTURE_EXTERNAL_OES;
652 arbitrary_resource2.mailbox_holder.sync_point = arbitrary_uint2; 654 arbitrary_resource2.mailbox_holder.sync_token = arbitrary_token2;
653 arbitrary_resource2.is_overlay_candidate = false; 655 arbitrary_resource2.is_overlay_candidate = false;
654 656
655 scoped_ptr<RenderPass> renderpass_in = RenderPass::Create(); 657 scoped_ptr<RenderPass> renderpass_in = RenderPass::Create();
656 renderpass_in->SetNew( 658 renderpass_in->SetNew(
657 RenderPassId(1, 1), gfx::Rect(), gfx::Rect(), gfx::Transform()); 659 RenderPassId(1, 1), gfx::Rect(), gfx::Rect(), gfx::Transform());
658 660
659 DelegatedFrameData frame_in; 661 DelegatedFrameData frame_in;
660 frame_in.resource_list.push_back(arbitrary_resource1); 662 frame_in.resource_list.push_back(arbitrary_resource1);
661 frame_in.resource_list.push_back(arbitrary_resource2); 663 frame_in.resource_list.push_back(arbitrary_resource2);
662 frame_in.render_pass_list.push_back(renderpass_in.Pass()); 664 frame_in.render_pass_list.push_back(renderpass_in.Pass());
663 665
664 IPC::ParamTraits<DelegatedFrameData>::Write(&msg, frame_in); 666 IPC::ParamTraits<DelegatedFrameData>::Write(&msg, frame_in);
665 667
666 DelegatedFrameData frame_out; 668 DelegatedFrameData frame_out;
667 base::PickleIterator iter(msg); 669 base::PickleIterator iter(msg);
668 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg, 670 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg,
669 &iter, &frame_out)); 671 &iter, &frame_out));
670 672
671 ASSERT_EQ(2u, frame_out.resource_list.size()); 673 ASSERT_EQ(2u, frame_out.resource_list.size());
672 Compare(arbitrary_resource1, frame_out.resource_list[0]); 674 Compare(arbitrary_resource1, frame_out.resource_list[0]);
673 Compare(arbitrary_resource2, frame_out.resource_list[1]); 675 Compare(arbitrary_resource2, frame_out.resource_list[1]);
674 } 676 }
675 677
676 } // namespace 678 } // namespace
677 } // namespace content 679 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698