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

Side by Side Diff: cc/surfaces/compositor_frame_sink_support_unittest.cc

Issue 2905523003: Revert of Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "cc/surfaces/compositor_frame_sink_support.h" 5 #include "cc/surfaces/compositor_frame_sink_support.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/copy_output_request.h" 9 #include "cc/output/copy_output_request.h"
10 #include "cc/output/copy_output_result.h" 10 #include "cc/output/copy_output_result.h"
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 TEST_F(CompositorFrameSinkSupportTest, DestroyCycle) { 665 TEST_F(CompositorFrameSinkSupportTest, DestroyCycle) {
666 LocalSurfaceId local_surface_id2(5, kArbitraryToken); 666 LocalSurfaceId local_surface_id2(5, kArbitraryToken);
667 SurfaceId id2(kYetAnotherArbitraryFrameSinkId, local_surface_id2); 667 SurfaceId id2(kYetAnotherArbitraryFrameSinkId, local_surface_id2);
668 std::unique_ptr<CompositorFrameSinkSupport> support2 = 668 std::unique_ptr<CompositorFrameSinkSupport> support2 =
669 CompositorFrameSinkSupport::Create( 669 CompositorFrameSinkSupport::Create(
670 &fake_support_client_, &manager_, kYetAnotherArbitraryFrameSinkId, 670 &fake_support_client_, &manager_, kYetAnotherArbitraryFrameSinkId,
671 kIsChildRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); 671 kIsChildRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints);
672 manager_.RegisterFrameSinkId(kAnotherArbitraryFrameSinkId); 672 manager_.RegisterFrameSinkId(kAnotherArbitraryFrameSinkId);
673 // Give id2 a frame that references local_surface_id_. 673 // Give id2 a frame that references local_surface_id_.
674 { 674 {
675 std::unique_ptr<RenderPass> render_pass(RenderPass::Create());
675 CompositorFrame frame = MakeCompositorFrame(); 676 CompositorFrame frame = MakeCompositorFrame();
677 frame.render_pass_list.push_back(std::move(render_pass));
676 frame.metadata.referenced_surfaces.push_back( 678 frame.metadata.referenced_surfaces.push_back(
677 SurfaceId(support_->frame_sink_id(), local_surface_id_)); 679 SurfaceId(support_->frame_sink_id(), local_surface_id_));
678 support2->SubmitCompositorFrame(local_surface_id2, std::move(frame)); 680 support2->SubmitCompositorFrame(local_surface_id2, std::move(frame));
679 EXPECT_EQ(last_created_surface_id().local_surface_id(), local_surface_id2); 681 EXPECT_EQ(last_created_surface_id().local_surface_id(), local_surface_id2);
680 } 682 }
681 manager_.GetSurfaceForId(id2)->AddDestructionDependency( 683 manager_.GetSurfaceForId(id2)->AddDestructionDependency(
682 SurfaceSequence(kAnotherArbitraryFrameSinkId, 4)); 684 SurfaceSequence(kAnotherArbitraryFrameSinkId, 4));
683 support2->EvictCurrentSurface(); 685 support2->EvictCurrentSurface();
684 // Give local_surface_id_ a frame that references id2. 686 // Give local_surface_id_ a frame that references id2.
685 { 687 {
688 std::unique_ptr<RenderPass> render_pass(RenderPass::Create());
686 CompositorFrame frame = MakeCompositorFrame(); 689 CompositorFrame frame = MakeCompositorFrame();
690 frame.render_pass_list.push_back(std::move(render_pass));
687 frame.metadata.referenced_surfaces.push_back(id2); 691 frame.metadata.referenced_surfaces.push_back(id2);
688 support_->SubmitCompositorFrame(local_surface_id_, std::move(frame)); 692 support_->SubmitCompositorFrame(local_surface_id_, std::move(frame));
689 } 693 }
690 support_->EvictCurrentSurface(); 694 support_->EvictCurrentSurface();
691 EXPECT_TRUE(manager_.GetSurfaceForId(id2)); 695 EXPECT_TRUE(manager_.GetSurfaceForId(id2));
692 // local_surface_id_ should be retained by reference from id2. 696 // local_surface_id_ should be retained by reference from id2.
693 EXPECT_TRUE(manager_.GetSurfaceForId( 697 EXPECT_TRUE(manager_.GetSurfaceForId(
694 SurfaceId(support_->frame_sink_id(), local_surface_id_))); 698 SurfaceId(support_->frame_sink_id(), local_surface_id_)));
695 699
696 // Satisfy last destruction dependency for id2. 700 // Satisfy last destruction dependency for id2.
697 manager_.SatisfySequence(SurfaceSequence(kAnotherArbitraryFrameSinkId, 4)); 701 manager_.SatisfySequence(SurfaceSequence(kAnotherArbitraryFrameSinkId, 4));
698 702
699 // id2 and local_surface_id_ are in a reference cycle that has no surface 703 // id2 and local_surface_id_ are in a reference cycle that has no surface
700 // sequences holding on to it, so they should be destroyed. 704 // sequences holding on to it, so they should be destroyed.
701 EXPECT_TRUE(!manager_.GetSurfaceForId(id2)); 705 EXPECT_TRUE(!manager_.GetSurfaceForId(id2));
702 EXPECT_TRUE(!manager_.GetSurfaceForId( 706 EXPECT_TRUE(!manager_.GetSurfaceForId(
703 SurfaceId(support_->frame_sink_id(), local_surface_id_))); 707 SurfaceId(support_->frame_sink_id(), local_surface_id_)));
704 708
705 local_surface_id_ = LocalSurfaceId(); 709 local_surface_id_ = LocalSurfaceId();
706 } 710 }
707 711
708 void CopyRequestTestCallback(bool* called, 712 void CopyRequestTestCallback(bool* called,
709 std::unique_ptr<CopyOutputResult> result) { 713 std::unique_ptr<CopyOutputResult> result) {
710 *called = true; 714 *called = true;
711 } 715 }
712 716
713 TEST_F(CompositorFrameSinkSupportTest, DuplicateCopyRequest) { 717 TEST_F(CompositorFrameSinkSupportTest, DuplicateCopyRequest) {
714 { 718 {
719 std::unique_ptr<RenderPass> render_pass(RenderPass::Create());
715 CompositorFrame frame = MakeCompositorFrame(); 720 CompositorFrame frame = MakeCompositorFrame();
721 frame.render_pass_list.push_back(std::move(render_pass));
716 frame.metadata.referenced_surfaces.push_back( 722 frame.metadata.referenced_surfaces.push_back(
717 SurfaceId(support_->frame_sink_id(), local_surface_id_)); 723 SurfaceId(support_->frame_sink_id(), local_surface_id_));
718 support_->SubmitCompositorFrame(local_surface_id_, std::move(frame)); 724 support_->SubmitCompositorFrame(local_surface_id_, std::move(frame));
719 EXPECT_EQ(last_created_surface_id().local_surface_id(), local_surface_id_); 725 EXPECT_EQ(last_created_surface_id().local_surface_id(), local_surface_id_);
720 } 726 }
721 727
722 bool called1 = false; 728 bool called1 = false;
723 std::unique_ptr<CopyOutputRequest> request; 729 std::unique_ptr<CopyOutputRequest> request;
724 request = CopyOutputRequest::CreateRequest( 730 request = CopyOutputRequest::CreateRequest(
725 base::Bind(&CopyRequestTestCallback, &called1)); 731 base::Bind(&CopyRequestTestCallback, &called1));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 EXPECT_EQ(expected_surface_id, last_surface_info_.id()); 782 EXPECT_EQ(expected_surface_id, last_surface_info_.id());
777 EXPECT_EQ(2.5f, last_surface_info_.device_scale_factor()); 783 EXPECT_EQ(2.5f, last_surface_info_.device_scale_factor());
778 EXPECT_EQ(gfx::Size(7, 8), last_surface_info_.size_in_pixels()); 784 EXPECT_EQ(gfx::Size(7, 8), last_surface_info_.size_in_pixels());
779 } 785 }
780 786
781 } // namespace 787 } // namespace
782 788
783 } // namespace test 789 } // namespace test
784 790
785 } // namespace cc 791 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/compositor_frame_sink_support.cc ('k') | cc/surfaces/direct_compositor_frame_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698