| 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/macros.h" | 7 #include "base/macros.h" |
| 8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/surfaces/compositor_frame_sink_support_client.h" | 9 #include "cc/surfaces/compositor_frame_sink_support_client.h" |
| 10 #include "cc/surfaces/frame_sink_id.h" | 10 #include "cc/surfaces/frame_sink_id.h" |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 EXPECT_TRUE(child_surface1()->HasActiveFrame()); | 566 EXPECT_TRUE(child_surface1()->HasActiveFrame()); |
| 567 EXPECT_FALSE(child_surface1()->HasPendingFrame()); | 567 EXPECT_FALSE(child_surface1()->HasPendingFrame()); |
| 568 EXPECT_THAT(child_surface1()->blocking_surfaces_for_testing(), IsEmpty()); | 568 EXPECT_THAT(child_surface1()->blocking_surfaces_for_testing(), IsEmpty()); |
| 569 | 569 |
| 570 // Verify that there is no temporary reference for the child and that | 570 // Verify that there is no temporary reference for the child and that |
| 571 // the reference from the parent to the child still exists. | 571 // the reference from the parent to the child still exists. |
| 572 EXPECT_THAT(GetTempReferences(child_id.frame_sink_id()), IsEmpty()); | 572 EXPECT_THAT(GetTempReferences(child_id.frame_sink_id()), IsEmpty()); |
| 573 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id)); | 573 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id)); |
| 574 } | 574 } |
| 575 | 575 |
| 576 // The parent Surface is blocked on |child_id2| which is blocked on |child_id3|. |
| 577 // child_support1 evicts its blocked Surface. The parent surface should |
| 578 // activate. |
| 579 TEST_F(CompositorFrameSinkSupportTest, EvictSurfaceWithPendingFrame) { |
| 580 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); |
| 581 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); |
| 582 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); |
| 583 |
| 584 // Submit a CompositorFrame that depends on |child_id1|. |
| 585 parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(), |
| 586 MakeCompositorFrame({child_id1})); |
| 587 |
| 588 // Verify that the CompositorFrame is blocked on |child_id1|. |
| 589 EXPECT_FALSE(parent_surface()->HasActiveFrame()); |
| 590 EXPECT_TRUE(parent_surface()->HasPendingFrame()); |
| 591 EXPECT_THAT(parent_surface()->blocking_surfaces_for_testing(), |
| 592 UnorderedElementsAre(child_id1)); |
| 593 |
| 594 // Submit a CompositorFrame that depends on |child_id2|. |
| 595 child_support1().SubmitCompositorFrame(child_id1.local_surface_id(), |
| 596 MakeCompositorFrame({child_id2})); |
| 597 |
| 598 // Verify that the CompositorFrame is blocked on |child_id2|. |
| 599 EXPECT_FALSE(child_surface1()->HasActiveFrame()); |
| 600 EXPECT_TRUE(child_surface1()->HasPendingFrame()); |
| 601 EXPECT_THAT(child_surface1()->blocking_surfaces_for_testing(), |
| 602 UnorderedElementsAre(child_id2)); |
| 603 |
| 604 // Evict child_support1's current Surface. |
| 605 // TODO(fsamuel): EvictFrame => EvictCurrentSurface. |
| 606 child_support1().EvictFrame(); |
| 607 |
| 608 // The parent Surface should immediately activate. |
| 609 EXPECT_TRUE(parent_surface()->HasActiveFrame()); |
| 610 EXPECT_FALSE(parent_surface()->HasPendingFrame()); |
| 611 EXPECT_THAT(parent_surface()->blocking_surfaces_for_testing(), IsEmpty()); |
| 612 EXPECT_FALSE(dependency_tracker().has_deadline()); |
| 613 } |
| 614 |
| 576 } // namespace test | 615 } // namespace test |
| 577 } // namespace cc | 616 } // namespace cc |
| OLD | NEW |