| OLD | NEW |
| 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/debug/stack_trace.h" | 7 #include "base/debug/stack_trace.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "cc/surfaces/compositor_frame_sink_support_client.h" | 10 #include "cc/surfaces/compositor_frame_sink_support_client.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupportTest); | 232 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupportTest); |
| 233 }; | 233 }; |
| 234 | 234 |
| 235 // The display root surface should have a surface reference from the top-level | 235 // The display root surface should have a surface reference from the top-level |
| 236 // root added/removed when a CompositorFrame is submitted with a new SurfaceId. | 236 // root added/removed when a CompositorFrame is submitted with a new SurfaceId. |
| 237 TEST_F(CompositorFrameSinkSupportTest, RootSurfaceReceivesReferences) { | 237 TEST_F(CompositorFrameSinkSupportTest, RootSurfaceReceivesReferences) { |
| 238 const SurfaceId display_id_first = MakeSurfaceId(kDisplayFrameSink, 1); | 238 const SurfaceId display_id_first = MakeSurfaceId(kDisplayFrameSink, 1); |
| 239 const SurfaceId display_id_second = MakeSurfaceId(kDisplayFrameSink, 2); | 239 const SurfaceId display_id_second = MakeSurfaceId(kDisplayFrameSink, 2); |
| 240 | 240 |
| 241 // Submit a CompositorFrame for the first display root surface. | 241 // Submit a CompositorFrame for the first display root surface. |
| 242 display_support().SubmitCompositorFrame( | 242 display_support().SubmitCompositorFrame(display_id_first.local_surface_id(), |
| 243 display_id_first.local_surface_id(), | 243 MakeCompositorFrame()); |
| 244 MakeCompositorFrame({MakeSurfaceId(kParentFrameSink, 1)})); | |
| 245 | 244 |
| 246 // A surface reference from the top-level root is added and there shouldn't be | 245 // A surface reference from the top-level root is added and there shouldn't be |
| 247 // a temporary reference. | 246 // a temporary reference. |
| 248 EXPECT_FALSE(HasTemporaryReference(display_id_first)); | 247 EXPECT_FALSE(HasTemporaryReference(display_id_first)); |
| 249 EXPECT_THAT(GetChildReferences(surface_manager().GetRootSurfaceId()), | 248 EXPECT_THAT(GetChildReferences(surface_manager().GetRootSurfaceId()), |
| 250 UnorderedElementsAre(display_id_first)); | 249 UnorderedElementsAre(display_id_first)); |
| 251 | 250 |
| 252 // Submit a CompositorFrame for the second display root surface. | 251 // Submit a CompositorFrame for the second display root surface. |
| 253 display_support().SubmitCompositorFrame( | 252 display_support().SubmitCompositorFrame(display_id_second.local_surface_id(), |
| 254 display_id_second.local_surface_id(), | 253 MakeCompositorFrame()); |
| 255 MakeCompositorFrame({MakeSurfaceId(kParentFrameSink, 2)})); | |
| 256 | 254 |
| 257 // A surface reference from the top-level root to |display_id_second| should | 255 // A surface reference from the top-level root to |display_id_second| should |
| 258 // be added and the reference to |display_root_first| removed. | 256 // be added and the reference to |display_root_first| removed. |
| 259 EXPECT_FALSE(HasTemporaryReference(display_id_second)); | 257 EXPECT_FALSE(HasTemporaryReference(display_id_second)); |
| 260 EXPECT_THAT(GetChildReferences(surface_manager().GetRootSurfaceId()), | 258 EXPECT_THAT(GetChildReferences(surface_manager().GetRootSurfaceId()), |
| 261 UnorderedElementsAre(display_id_second)); | 259 UnorderedElementsAre(display_id_second)); |
| 262 | 260 |
| 263 // Surface |display_id_first| is unreachable and should get deleted. | 261 // Surface |display_id_first| is unreachable and should get deleted. |
| 264 EXPECT_EQ(nullptr, surface_manager().GetSurfaceForId(display_id_first)); | 262 EXPECT_EQ(nullptr, surface_manager().GetSurfaceForId(display_id_first)); |
| 265 } | 263 } |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 // Submit a CompositorFrame that has no dependencies. | 519 // Submit a CompositorFrame that has no dependencies. |
| 522 parent_support().SubmitCompositorFrame( | 520 parent_support().SubmitCompositorFrame( |
| 523 parent_id.local_surface_id(), MakeCompositorFrame(empty_surface_ids())); | 521 parent_id.local_surface_id(), MakeCompositorFrame(empty_surface_ids())); |
| 524 | 522 |
| 525 // Verify that the CompositorFrame has been activated. | 523 // Verify that the CompositorFrame has been activated. |
| 526 EXPECT_TRUE(parent_surface()->HasActiveFrame()); | 524 EXPECT_TRUE(parent_surface()->HasActiveFrame()); |
| 527 EXPECT_FALSE(parent_surface()->HasPendingFrame()); | 525 EXPECT_FALSE(parent_surface()->HasPendingFrame()); |
| 528 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); | 526 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); |
| 529 } | 527 } |
| 530 | 528 |
| 531 // This test verifies that the set of references from a Surface includes both | 529 // This test verifies that a pending CompositorFrame does not affect surface |
| 532 // the pending and active CompositorFrames. | 530 // references. A new surface from a child will continue to exist as a temporary |
| 531 // reference until the parent's frame activates. |
| 533 TEST_F(CompositorFrameSinkSupportTest, | 532 TEST_F(CompositorFrameSinkSupportTest, |
| 534 DisplayCompositorLockingReferencesFromPendingAndActiveFrames) { | 533 OnlyActiveFramesAffectSurfaceReferences) { |
| 535 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); | 534 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); |
| 536 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); | 535 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); |
| 537 const SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1); | 536 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); |
| 538 const SurfaceReference parent_child_reference(parent_id, child_id); | |
| 539 const SurfaceReference parent_arbitrary_reference(parent_id, arbitrary_id); | |
| 540 | 537 |
| 541 // child_support1 submits a CompositorFrame without any dependencies. | 538 // child_support1 submits a CompositorFrame without any dependencies. |
| 542 child_support1().SubmitCompositorFrame( | 539 child_support1().SubmitCompositorFrame(child_id1.local_surface_id(), |
| 543 child_id.local_surface_id(), MakeCompositorFrame(empty_surface_ids())); | 540 MakeCompositorFrame()); |
| 544 | 541 |
| 545 // Verify that the child surface is not blocked. | 542 // Verify that the child surface is not blocked. |
| 546 EXPECT_TRUE(child_surface1()->HasActiveFrame()); | 543 EXPECT_TRUE(child_surface1()->HasActiveFrame()); |
| 547 EXPECT_FALSE(child_surface1()->HasPendingFrame()); | 544 EXPECT_FALSE(child_surface1()->HasPendingFrame()); |
| 548 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty()); | 545 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty()); |
| 549 | 546 |
| 547 // Verify that there's a temporary reference for |child_id1|. |
| 548 EXPECT_TRUE(HasTemporaryReference(child_id1)); |
| 549 |
| 550 // parent_support submits a CompositorFrame that depends on |child_id1| | 550 // parent_support submits a CompositorFrame that depends on |child_id1| |
| 551 // which is already active. Thus, this CompositorFrame should activate | 551 // (which is already active) and |child_id2|. Thus, the parent should not |
| 552 // immediately. | 552 // activate immediately. |
| 553 parent_support().SubmitCompositorFrame(parent_id.local_surface_id(), | 553 parent_support().SubmitCompositorFrame( |
| 554 MakeCompositorFrame({child_id})); | 554 parent_id.local_surface_id(), |
| 555 MakeCompositorFrame({child_id1, child_id2})); |
| 556 EXPECT_FALSE(parent_surface()->HasActiveFrame()); |
| 557 EXPECT_TRUE(parent_surface()->HasPendingFrame()); |
| 558 EXPECT_THAT(parent_surface()->blocking_surfaces(), |
| 559 UnorderedElementsAre(child_id2)); |
| 560 EXPECT_THAT(GetChildReferences(parent_id), IsEmpty()); |
| 561 |
| 562 // Verify that there's a temporary reference for |child_id1| that still |
| 563 // exists. |
| 564 EXPECT_TRUE(HasTemporaryReference(child_id1)); |
| 565 |
| 566 // child_support2 submits a CompositorFrame without any dependencies. |
| 567 child_support2().SubmitCompositorFrame(child_id2.local_surface_id(), |
| 568 MakeCompositorFrame()); |
| 569 |
| 570 // Verify that the child surface is not blocked. |
| 571 EXPECT_TRUE(child_surface1()->HasActiveFrame()); |
| 572 EXPECT_FALSE(child_surface1()->HasPendingFrame()); |
| 573 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty()); |
| 574 |
| 575 // Verify that the parent surface's CompositorFrame has activated and that the |
| 576 // temporary reference has been replaced by a permanent one. |
| 555 EXPECT_TRUE(parent_surface()->HasActiveFrame()); | 577 EXPECT_TRUE(parent_surface()->HasActiveFrame()); |
| 556 EXPECT_FALSE(parent_surface()->HasPendingFrame()); | 578 EXPECT_FALSE(parent_surface()->HasPendingFrame()); |
| 557 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); | 579 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); |
| 558 // Verify that the parent will add a reference to the |child_id|. | 580 EXPECT_FALSE(HasTemporaryReference(child_id1)); |
| 559 EXPECT_THAT(parent_reference_tracker().references_to_add(), | 581 EXPECT_THAT(GetChildReferences(parent_id), |
| 560 UnorderedElementsAre(parent_child_reference)); | 582 UnorderedElementsAre(child_id1, child_id2)); |
| 561 EXPECT_THAT(parent_reference_tracker().references_to_remove(), IsEmpty()); | |
| 562 | |
| 563 // parent_support now submits another CompositorFrame to the same surface | |
| 564 // but depends on arbitrary_id. The parent surface should now have both | |
| 565 // a pending and active CompositorFrame. | |
| 566 parent_support().SubmitCompositorFrame(parent_id.local_surface_id(), | |
| 567 MakeCompositorFrame({arbitrary_id})); | |
| 568 EXPECT_TRUE(parent_surface()->HasActiveFrame()); | |
| 569 EXPECT_TRUE(parent_surface()->HasPendingFrame()); | |
| 570 EXPECT_THAT(parent_surface()->blocking_surfaces(), | |
| 571 UnorderedElementsAre(arbitrary_id)); | |
| 572 // Verify that the parent will add a reference to |arbitrary_id| and will not | |
| 573 // remove a reference to |child_id|. | |
| 574 EXPECT_THAT(parent_reference_tracker().references_to_add(), | |
| 575 UnorderedElementsAre(parent_arbitrary_reference)); | |
| 576 EXPECT_THAT(parent_reference_tracker().references_to_remove(), IsEmpty()); | |
| 577 } | 583 } |
| 578 | 584 |
| 579 // This test verifies that we do not double count returned resources when a | 585 // This test verifies that we do not double count returned resources when a |
| 580 // CompositorFrame starts out as pending, then becomes active, and then is | 586 // CompositorFrame starts out as pending, then becomes active, and then is |
| 581 // replaced with another active CompositorFrame. | 587 // replaced with another active CompositorFrame. |
| 582 TEST_F(CompositorFrameSinkSupportTest, | 588 TEST_F(CompositorFrameSinkSupportTest, |
| 583 DisplayCompositorLockingResourcesOnlyReturnedOnce) { | 589 DisplayCompositorLockingResourcesOnlyReturnedOnce) { |
| 584 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); | 590 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); |
| 585 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); | 591 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); |
| 586 | 592 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 parent_support().SubmitCompositorFrame( | 626 parent_support().SubmitCompositorFrame( |
| 621 parent_id.local_surface_id(), MakeCompositorFrame({empty_surface_ids()})); | 627 parent_id.local_surface_id(), MakeCompositorFrame({empty_surface_ids()})); |
| 622 EXPECT_TRUE(parent_surface()->HasActiveFrame()); | 628 EXPECT_TRUE(parent_surface()->HasActiveFrame()); |
| 623 EXPECT_FALSE(parent_surface()->HasPendingFrame()); | 629 EXPECT_FALSE(parent_surface()->HasPendingFrame()); |
| 624 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); | 630 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); |
| 625 ReturnedResource returned_resource = resource.ToReturnedResource(); | 631 ReturnedResource returned_resource = resource.ToReturnedResource(); |
| 626 EXPECT_THAT(support_client_.last_returned_resources(), | 632 EXPECT_THAT(support_client_.last_returned_resources(), |
| 627 UnorderedElementsAre(returned_resource)); | 633 UnorderedElementsAre(returned_resource)); |
| 628 } | 634 } |
| 629 | 635 |
| 630 // This test verifies that a SurfaceReference from parent to child can be added | |
| 631 // prior to the child submitting a CompositorFrame. This test also verifies that | |
| 632 // when the child later submits a CompositorFrame, | |
| 633 TEST_F(CompositorFrameSinkSupportTest, | |
| 634 DisplayCompositorLockingReferenceAddedBeforeChildExists) { | |
| 635 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); | |
| 636 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); | |
| 637 | |
| 638 // The parent submits a CompositorFrame that depends on |child_id| before the | |
| 639 // child submits a CompositorFrame. | |
| 640 parent_support().SubmitCompositorFrame(parent_id.local_surface_id(), | |
| 641 MakeCompositorFrame({child_id})); | |
| 642 | |
| 643 // Verify that the CompositorFrame is blocked on |child_id|. | |
| 644 EXPECT_FALSE(parent_surface()->HasActiveFrame()); | |
| 645 EXPECT_TRUE(parent_surface()->HasPendingFrame()); | |
| 646 EXPECT_THAT(parent_surface()->blocking_surfaces(), | |
| 647 UnorderedElementsAre(child_id)); | |
| 648 | |
| 649 // Verify that a SurfaceReference(parent_id, child_id) exists in the | |
| 650 // SurfaceManager. | |
| 651 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id)); | |
| 652 | |
| 653 child_support1().SubmitCompositorFrame( | |
| 654 child_id.local_surface_id(), MakeCompositorFrame(empty_surface_ids())); | |
| 655 | |
| 656 // Verify that the child CompositorFrame activates immediately. | |
| 657 EXPECT_TRUE(child_surface1()->HasActiveFrame()); | |
| 658 EXPECT_FALSE(child_surface1()->HasPendingFrame()); | |
| 659 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty()); | |
| 660 | |
| 661 // Verify that there is no temporary reference for the child and that | |
| 662 // the reference from the parent to the child still exists. | |
| 663 EXPECT_FALSE(HasTemporaryReference(child_id)); | |
| 664 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id)); | |
| 665 } | |
| 666 | |
| 667 // The parent Surface is blocked on |child_id2| which is blocked on |child_id3|. | 636 // The parent Surface is blocked on |child_id2| which is blocked on |child_id3|. |
| 668 // child_support1 evicts its blocked Surface. The parent surface should | 637 // child_support1 evicts its blocked Surface. The parent surface should |
| 669 // activate. | 638 // activate. |
| 670 TEST_F(CompositorFrameSinkSupportTest, EvictSurfaceWithPendingFrame) { | 639 TEST_F(CompositorFrameSinkSupportTest, EvictSurfaceWithPendingFrame) { |
| 671 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); | 640 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); |
| 672 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); | 641 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); |
| 673 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); | 642 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); |
| 674 | 643 |
| 675 // Submit a CompositorFrame that depends on |child_id1|. | 644 // Submit a CompositorFrame that depends on |child_id1|. |
| 676 parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(), | 645 parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 // child submits a CompositorFrame. | 686 // child submits a CompositorFrame. |
| 718 parent_support().SubmitCompositorFrame(parent_id.local_surface_id(), | 687 parent_support().SubmitCompositorFrame(parent_id.local_surface_id(), |
| 719 MakeCompositorFrame({child_id1})); | 688 MakeCompositorFrame({child_id1})); |
| 720 | 689 |
| 721 // Verify that the CompositorFrame is blocked on |child_id|. | 690 // Verify that the CompositorFrame is blocked on |child_id|. |
| 722 EXPECT_FALSE(parent_surface()->HasActiveFrame()); | 691 EXPECT_FALSE(parent_surface()->HasActiveFrame()); |
| 723 EXPECT_TRUE(parent_surface()->HasPendingFrame()); | 692 EXPECT_TRUE(parent_surface()->HasPendingFrame()); |
| 724 EXPECT_THAT(parent_surface()->blocking_surfaces(), | 693 EXPECT_THAT(parent_surface()->blocking_surfaces(), |
| 725 UnorderedElementsAre(child_id1)); | 694 UnorderedElementsAre(child_id1)); |
| 726 | 695 |
| 727 // Verify that a SurfaceReference(parent_id, child_id1) exists in the | 696 // Verify that no references are added while the CompositorFrame is pending. |
| 728 // SurfaceManager. | 697 EXPECT_THAT(GetChildReferences(parent_id), IsEmpty()); |
| 729 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id1)); | |
| 730 | 698 |
| 731 child_support1().SubmitCompositorFrame( | 699 child_support1().SubmitCompositorFrame( |
| 732 child_id1.local_surface_id(), MakeCompositorFrame(empty_surface_ids())); | 700 child_id1.local_surface_id(), MakeCompositorFrame(empty_surface_ids())); |
| 733 | 701 |
| 734 // Verify that the child CompositorFrame activates immediately. | 702 // Verify that the child CompositorFrame activates immediately. |
| 735 EXPECT_TRUE(child_surface1()->HasActiveFrame()); | 703 EXPECT_TRUE(child_surface1()->HasActiveFrame()); |
| 736 EXPECT_FALSE(child_surface1()->HasPendingFrame()); | 704 EXPECT_FALSE(child_surface1()->HasPendingFrame()); |
| 737 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty()); | 705 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty()); |
| 738 | 706 |
| 739 // Verify that the parent Surface has activated. | 707 // Verify that the parent Surface has activated. |
| 740 EXPECT_TRUE(parent_surface()->HasActiveFrame()); | 708 EXPECT_TRUE(parent_surface()->HasActiveFrame()); |
| 741 EXPECT_FALSE(parent_surface()->HasPendingFrame()); | 709 EXPECT_FALSE(parent_surface()->HasPendingFrame()); |
| 742 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); | 710 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); |
| 743 | 711 |
| 744 // Verify that there is no temporary reference for the child and that | 712 // Verify that there is no temporary reference for the child and that |
| 745 // the reference from the parent to the child still exists. | 713 // the reference from the parent to the child still exists. |
| 746 EXPECT_FALSE(HasTemporaryReference(child_id1)); | 714 EXPECT_FALSE(HasTemporaryReference(child_id1)); |
| 747 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id1)); | 715 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id1)); |
| 748 | 716 |
| 749 // The parent submits another CompositorFrame that depends on |child_id2|. | 717 // The parent submits another CompositorFrame that depends on |child_id2|. |
| 750 parent_support().SubmitCompositorFrame(parent_id.local_surface_id(), | 718 parent_support().SubmitCompositorFrame(parent_id.local_surface_id(), |
| 751 MakeCompositorFrame({child_id2})); | 719 MakeCompositorFrame({child_id2})); |
| 752 | 720 |
| 753 // The parent surface should now have both a pending and activate | 721 // The parent surface should now have both a pending and activate |
| 754 // CompositorFrame. Verify that the set of child references from | 722 // CompositorFrame. Verify that the set of child references from |
| 755 // |parent_id| include both the pending and active CompositorFrames. | 723 // |parent_id| are only from the active CompositorFrame. |
| 756 EXPECT_TRUE(parent_surface()->HasActiveFrame()); | 724 EXPECT_TRUE(parent_surface()->HasActiveFrame()); |
| 757 EXPECT_TRUE(parent_surface()->HasPendingFrame()); | 725 EXPECT_TRUE(parent_surface()->HasPendingFrame()); |
| 758 EXPECT_THAT(parent_surface()->blocking_surfaces(), | 726 EXPECT_THAT(parent_surface()->blocking_surfaces(), |
| 759 UnorderedElementsAre(child_id2)); | 727 UnorderedElementsAre(child_id2)); |
| 760 EXPECT_THAT(GetChildReferences(parent_id), | 728 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id1)); |
| 761 UnorderedElementsAre(child_id1, child_id2)); | |
| 762 | 729 |
| 763 child_support2().SubmitCompositorFrame( | 730 child_support2().SubmitCompositorFrame( |
| 764 child_id2.local_surface_id(), MakeCompositorFrame(empty_surface_ids())); | 731 child_id2.local_surface_id(), MakeCompositorFrame(empty_surface_ids())); |
| 765 | 732 |
| 766 // Verify that the parent Surface has activated and no longer has a pending | 733 // Verify that the parent Surface has activated and no longer has a pending |
| 767 // CompositorFrame. Also verify that |child_id1| is no longer a child | 734 // CompositorFrame. Also verify that |child_id1| is no longer a child |
| 768 // reference of |parent_id|. | 735 // reference of |parent_id|. |
| 769 EXPECT_TRUE(parent_surface()->HasActiveFrame()); | 736 EXPECT_TRUE(parent_surface()->HasActiveFrame()); |
| 770 EXPECT_FALSE(parent_surface()->HasPendingFrame()); | 737 EXPECT_FALSE(parent_surface()->HasPendingFrame()); |
| 771 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); | 738 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 MakeCompositorFrame({parent_id1}, {parent_id1, parent_id2})); | 1184 MakeCompositorFrame({parent_id1}, {parent_id1, parent_id2})); |
| 1218 | 1185 |
| 1219 EXPECT_TRUE(display_surface()->HasPendingFrame()); | 1186 EXPECT_TRUE(display_surface()->HasPendingFrame()); |
| 1220 EXPECT_FALSE(display_surface()->HasActiveFrame()); | 1187 EXPECT_FALSE(display_surface()->HasActiveFrame()); |
| 1221 EXPECT_TRUE(dependency_tracker().has_deadline()); | 1188 EXPECT_TRUE(dependency_tracker().has_deadline()); |
| 1222 | 1189 |
| 1223 // Verify that the display CompositorFrame will only block on |parent_id1| but | 1190 // Verify that the display CompositorFrame will only block on |parent_id1| but |
| 1224 // not |parent_id2|. | 1191 // not |parent_id2|. |
| 1225 EXPECT_THAT(display_surface()->blocking_surfaces(), | 1192 EXPECT_THAT(display_surface()->blocking_surfaces(), |
| 1226 UnorderedElementsAre(parent_id1)); | 1193 UnorderedElementsAre(parent_id1)); |
| 1227 // Verify that the display CompositorFrame holds refernces to both | 1194 // Verify that the display surface holds no references while its |
| 1228 // |parent_id1| and |parent_id2|. | 1195 // CompositorFrame is pending. |
| 1229 EXPECT_THAT(GetChildReferences(display_id), | 1196 EXPECT_THAT(GetChildReferences(display_id), IsEmpty()); |
| 1230 UnorderedElementsAre(parent_id1, parent_id2)); | |
| 1231 | 1197 |
| 1232 // Submitting a CompositorFrame with |parent_id1| should unblock the display | 1198 // Submitting a CompositorFrame with |parent_id1| should unblock the display |
| 1233 // CompositorFrame. | 1199 // CompositorFrame. |
| 1234 parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(), | 1200 parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(), |
| 1235 MakeCompositorFrame()); | 1201 MakeCompositorFrame()); |
| 1236 | 1202 |
| 1237 EXPECT_FALSE(dependency_tracker().has_deadline()); | 1203 EXPECT_FALSE(dependency_tracker().has_deadline()); |
| 1238 EXPECT_FALSE(display_surface()->HasPendingFrame()); | 1204 EXPECT_FALSE(display_surface()->HasPendingFrame()); |
| 1239 EXPECT_TRUE(display_surface()->HasActiveFrame()); | 1205 EXPECT_TRUE(display_surface()->HasActiveFrame()); |
| 1240 EXPECT_THAT(display_surface()->blocking_surfaces(), IsEmpty()); | 1206 EXPECT_THAT(display_surface()->blocking_surfaces(), IsEmpty()); |
| 1241 EXPECT_THAT(GetChildReferences(display_id), | 1207 |
| 1242 UnorderedElementsAre(parent_id1, parent_id2)); | 1208 // Only a reference to |parent_id1| is added because |parent_id2| does not |
| 1209 // exist. |
| 1210 EXPECT_THAT(GetChildReferences(display_id), UnorderedElementsAre(parent_id1)); |
| 1243 } | 1211 } |
| 1244 | 1212 |
| 1245 } // namespace test | 1213 } // namespace test |
| 1246 } // namespace cc | 1214 } // namespace cc |
| OLD | NEW |