| Index: cc/surfaces/surface_synchronization_unittest.cc
|
| diff --git a/cc/surfaces/compositor_frame_sink_support_unittest.cc b/cc/surfaces/surface_synchronization_unittest.cc
|
| similarity index 81%
|
| copy from cc/surfaces/compositor_frame_sink_support_unittest.cc
|
| copy to cc/surfaces/surface_synchronization_unittest.cc
|
| index 03baed9f136e86d164576244f7934e0cf61af894..eda9b5108dcb5cffd5c8e3fbb18dbb0e74913d4c 100644
|
| --- a/cc/surfaces/compositor_frame_sink_support_unittest.cc
|
| +++ b/cc/surfaces/surface_synchronization_unittest.cc
|
| @@ -3,68 +3,34 @@
|
| // found in the LICENSE file.
|
|
|
| #include "cc/surfaces/compositor_frame_sink_support.h"
|
| -
|
| -#include "base/macros.h"
|
| -#include "cc/output/compositor_frame.h"
|
| -#include "cc/surfaces/compositor_frame_sink_support_client.h"
|
| -#include "cc/surfaces/frame_sink_id.h"
|
| #include "cc/surfaces/surface_id.h"
|
| #include "cc/surfaces/surface_manager.h"
|
| +#include "cc/surfaces/surface_observer.h"
|
| #include "cc/test/begin_frame_args_test.h"
|
| #include "cc/test/fake_external_begin_frame_source.h"
|
| +#include "cc/test/mock_compositor_frame_sink_support_client.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| -using testing::UnorderedElementsAre;
|
| -using testing::IsEmpty;
|
| -using testing::SizeIs;
|
| -using testing::Invoke;
|
| using testing::_;
|
| using testing::Eq;
|
| +using testing::IsEmpty;
|
| +using testing::UnorderedElementsAre;
|
|
|
| namespace cc {
|
| namespace test {
|
| namespace {
|
|
|
| +constexpr bool kIsRoot = true;
|
| +constexpr bool kIsChildRoot = false;
|
| +constexpr bool kHandlesFrameSinkIdInvalidation = true;
|
| +constexpr bool kNeedsSyncPoints = true;
|
| constexpr FrameSinkId kDisplayFrameSink(2, 0);
|
| constexpr FrameSinkId kParentFrameSink(3, 0);
|
| constexpr FrameSinkId kChildFrameSink1(65563, 0);
|
| constexpr FrameSinkId kChildFrameSink2(65564, 0);
|
| constexpr FrameSinkId kArbitraryFrameSink(1337, 7331);
|
|
|
| -class MockCompositorFrameSinkSupportClient
|
| - : public CompositorFrameSinkSupportClient {
|
| - public:
|
| - MockCompositorFrameSinkSupportClient() {
|
| - ON_CALL(*this, ReclaimResources(_))
|
| - .WillByDefault(Invoke(
|
| - this,
|
| - &MockCompositorFrameSinkSupportClient::ReclaimResourcesInternal));
|
| - ON_CALL(*this, DidReceiveCompositorFrameAck(_))
|
| - .WillByDefault(Invoke(
|
| - this,
|
| - &MockCompositorFrameSinkSupportClient::ReclaimResourcesInternal));
|
| - }
|
| -
|
| - ReturnedResourceArray& last_returned_resources() {
|
| - return last_returned_resources_;
|
| - }
|
| -
|
| - // CompositorFrameSinkSupportClient implementation.
|
| - MOCK_METHOD1(DidReceiveCompositorFrameAck,
|
| - void(const ReturnedResourceArray&));
|
| - MOCK_METHOD1(OnBeginFrame, void(const BeginFrameArgs&));
|
| - MOCK_METHOD1(ReclaimResources, void(const ReturnedResourceArray&));
|
| - MOCK_METHOD2(WillDrawSurface, void(const LocalSurfaceId&, const gfx::Rect&));
|
| -
|
| - private:
|
| - void ReclaimResourcesInternal(const ReturnedResourceArray& resources) {
|
| - last_returned_resources_ = resources;
|
| - }
|
| -
|
| - ReturnedResourceArray last_returned_resources_;
|
| -};
|
| -
|
| std::vector<SurfaceId> empty_surface_ids() {
|
| return std::vector<SurfaceId>();
|
| }
|
| @@ -75,63 +41,15 @@ SurfaceId MakeSurfaceId(const FrameSinkId& frame_sink_id, uint32_t local_id) {
|
| LocalSurfaceId(local_id, base::UnguessableToken::Deserialize(0, 1u)));
|
| }
|
|
|
| -CompositorFrame MakeCompositorFrame(std::vector<SurfaceId> embedded_surfaces,
|
| - std::vector<SurfaceId> referenced_surfaces,
|
| - TransferableResourceArray resource_list) {
|
| - CompositorFrame compositor_frame;
|
| - compositor_frame.metadata.begin_frame_ack = BeginFrameAck(0, 1, 1, true);
|
| - compositor_frame.metadata.embedded_surfaces = std::move(embedded_surfaces);
|
| - compositor_frame.metadata.referenced_surfaces =
|
| - std::move(referenced_surfaces);
|
| - compositor_frame.resource_list = std::move(resource_list);
|
| - return compositor_frame;
|
| -}
|
| -
|
| -CompositorFrame MakeCompositorFrame() {
|
| - return MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
|
| - TransferableResourceArray());
|
| -}
|
| -
|
| -CompositorFrame MakeCompositorFrame(std::vector<SurfaceId> embedded_surfaces) {
|
| - return MakeCompositorFrame(embedded_surfaces, embedded_surfaces,
|
| - TransferableResourceArray());
|
| -}
|
| -
|
| -CompositorFrame MakeCompositorFrame(
|
| - std::vector<SurfaceId> embedded_surfaces,
|
| - std::vector<SurfaceId> referenced_surfaces) {
|
| - return MakeCompositorFrame(std::move(embedded_surfaces),
|
| - std::move(referenced_surfaces),
|
| - TransferableResourceArray());
|
| -}
|
| -
|
| -CompositorFrame MakeCompositorFrameWithResources(
|
| - std::vector<SurfaceId> embedded_surfaces,
|
| - TransferableResourceArray resource_list) {
|
| - return MakeCompositorFrame(embedded_surfaces, embedded_surfaces,
|
| - std::move(resource_list));
|
| -}
|
| -
|
| -TransferableResource MakeResource(ResourceId id,
|
| - ResourceFormat format,
|
| - uint32_t filter,
|
| - const gfx::Size& size) {
|
| - TransferableResource resource;
|
| - resource.id = id;
|
| - resource.format = format;
|
| - resource.filter = filter;
|
| - resource.size = size;
|
| - return resource;
|
| -}
|
| -
|
| } // namespace
|
|
|
| -class CompositorFrameSinkSupportTest : public testing::Test,
|
| - public SurfaceObserver {
|
| +class SurfaceSynchronizationTest : public testing::Test,
|
| + public SurfaceObserver {
|
| public:
|
| - CompositorFrameSinkSupportTest()
|
| - : surface_manager_(SurfaceManager::LifetimeType::REFERENCES) {}
|
| - ~CompositorFrameSinkSupportTest() override {}
|
| + SurfaceSynchronizationTest()
|
| + : support_client_(false /* create_surface_during_eviction */),
|
| + surface_manager_(SurfaceManager::LifetimeType::REFERENCES) {}
|
| + ~SurfaceSynchronizationTest() override {}
|
|
|
| CompositorFrameSinkSupport& display_support() { return *supports_[0]; }
|
| Surface* display_surface() {
|
| @@ -185,10 +103,7 @@ class CompositorFrameSinkSupportTest : public testing::Test,
|
| // testing::Test:
|
| void SetUp() override {
|
| testing::Test::SetUp();
|
| - constexpr bool is_root = true;
|
| - constexpr bool is_child_root = false;
|
| - constexpr bool handles_frame_sink_id_invalidation = true;
|
| - constexpr bool needs_sync_points = true;
|
| +
|
| begin_frame_source_ =
|
| base::MakeUnique<FakeExternalBeginFrameSource>(0.f, false);
|
| surface_manager_.SetDependencyTracker(
|
| @@ -196,17 +111,17 @@ class CompositorFrameSinkSupportTest : public testing::Test,
|
| begin_frame_source_.get()));
|
| surface_manager_.AddObserver(this);
|
| supports_.push_back(CompositorFrameSinkSupport::Create(
|
| - &support_client_, &surface_manager_, kDisplayFrameSink, is_root,
|
| - handles_frame_sink_id_invalidation, needs_sync_points));
|
| + &support_client_, &surface_manager_, kDisplayFrameSink, kIsRoot,
|
| + kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints));
|
| supports_.push_back(CompositorFrameSinkSupport::Create(
|
| - &support_client_, &surface_manager_, kParentFrameSink, is_child_root,
|
| - handles_frame_sink_id_invalidation, needs_sync_points));
|
| + &support_client_, &surface_manager_, kParentFrameSink, kIsChildRoot,
|
| + kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints));
|
| supports_.push_back(CompositorFrameSinkSupport::Create(
|
| - &support_client_, &surface_manager_, kChildFrameSink1, is_child_root,
|
| - handles_frame_sink_id_invalidation, needs_sync_points));
|
| + &support_client_, &surface_manager_, kChildFrameSink1, kIsChildRoot,
|
| + kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints));
|
| supports_.push_back(CompositorFrameSinkSupport::Create(
|
| - &support_client_, &surface_manager_, kChildFrameSink2, is_child_root,
|
| - handles_frame_sink_id_invalidation, needs_sync_points));
|
| + &support_client_, &surface_manager_, kChildFrameSink2, kIsChildRoot,
|
| + kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints));
|
|
|
| // Normally, the BeginFrameSource would be registered by the Display. We
|
| // register it here so that BeginFrames are received by the display support,
|
| @@ -249,12 +164,12 @@ class CompositorFrameSinkSupportTest : public testing::Test,
|
| std::unique_ptr<FakeExternalBeginFrameSource> begin_frame_source_;
|
| std::vector<std::unique_ptr<CompositorFrameSinkSupport>> supports_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupportTest);
|
| + DISALLOW_COPY_AND_ASSIGN(SurfaceSynchronizationTest);
|
| };
|
|
|
| // The display root surface should have a surface reference from the top-level
|
| // root added/removed when a CompositorFrame is submitted with a new SurfaceId.
|
| -TEST_F(CompositorFrameSinkSupportTest, RootSurfaceReceivesReferences) {
|
| +TEST_F(SurfaceSynchronizationTest, RootSurfaceReceivesReferences) {
|
| const SurfaceId display_id_first = MakeSurfaceId(kDisplayFrameSink, 1);
|
| const SurfaceId display_id_second = MakeSurfaceId(kDisplayFrameSink, 2);
|
|
|
| @@ -283,14 +198,15 @@ TEST_F(CompositorFrameSinkSupportTest, RootSurfaceReceivesReferences) {
|
| }
|
|
|
| // The parent Surface is blocked on |child_id1| and |child_id2|.
|
| -TEST_F(CompositorFrameSinkSupportTest, DisplayCompositorLockingBlockedOnTwo) {
|
| +TEST_F(SurfaceSynchronizationTest, BlockedOnTwo) {
|
| const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
|
| const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1);
|
|
|
| parent_support().SubmitCompositorFrame(
|
| parent_id.local_surface_id(),
|
| - MakeCompositorFrame({child_id1, child_id2}));
|
| + MakeCompositorFrame({child_id1, child_id2}, {child_id1, child_id2},
|
| + TransferableResourceArray()));
|
|
|
| // parent_support is blocked on |child_id1| and |child_id2|.
|
| EXPECT_TRUE(dependency_tracker().has_deadline());
|
| @@ -302,7 +218,9 @@ TEST_F(CompositorFrameSinkSupportTest, DisplayCompositorLockingBlockedOnTwo) {
|
| // Submit a CompositorFrame without any dependencies to |child_id1|.
|
| // parent_support should now only be blocked on |child_id2|.
|
| child_support1().SubmitCompositorFrame(
|
| - child_id1.local_surface_id(), MakeCompositorFrame(empty_surface_ids()));
|
| + child_id1.local_surface_id(),
|
| + MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
|
| + TransferableResourceArray()));
|
|
|
| EXPECT_TRUE(dependency_tracker().has_deadline());
|
| EXPECT_FALSE(parent_surface()->HasActiveFrame());
|
| @@ -313,7 +231,9 @@ TEST_F(CompositorFrameSinkSupportTest, DisplayCompositorLockingBlockedOnTwo) {
|
| // Submit a CompositorFrame without any dependencies to |child_id2|.
|
| // parent_support should be activated.
|
| child_support2().SubmitCompositorFrame(
|
| - child_id2.local_surface_id(), MakeCompositorFrame(empty_surface_ids()));
|
| + child_id2.local_surface_id(),
|
| + MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
|
| + TransferableResourceArray()));
|
|
|
| EXPECT_FALSE(dependency_tracker().has_deadline());
|
| EXPECT_TRUE(parent_surface()->HasActiveFrame());
|
| @@ -322,13 +242,15 @@ TEST_F(CompositorFrameSinkSupportTest, DisplayCompositorLockingBlockedOnTwo) {
|
| }
|
|
|
| // The parent Surface is blocked on |child_id2| which is blocked on |child_id3|.
|
| -TEST_F(CompositorFrameSinkSupportTest, DisplayCompositorLockingBlockedChain) {
|
| +TEST_F(SurfaceSynchronizationTest, BlockedChain) {
|
| const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
|
| const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1);
|
|
|
| - parent_support().SubmitCompositorFrame(parent_id.local_surface_id(),
|
| - MakeCompositorFrame({child_id1}));
|
| + parent_support().SubmitCompositorFrame(
|
| + parent_id.local_surface_id(),
|
| + MakeCompositorFrame({child_id1}, {child_id1},
|
| + TransferableResourceArray()));
|
|
|
| // parent_support is blocked on |child_id1|.
|
| EXPECT_TRUE(dependency_tracker().has_deadline());
|
| @@ -339,8 +261,10 @@ TEST_F(CompositorFrameSinkSupportTest, DisplayCompositorLockingBlockedChain) {
|
| // The parent should not report damage until it activates.
|
| EXPECT_FALSE(IsSurfaceDamaged(parent_id));
|
|
|
| - child_support1().SubmitCompositorFrame(child_id1.local_surface_id(),
|
| - MakeCompositorFrame({child_id2}));
|
| + child_support1().SubmitCompositorFrame(
|
| + child_id1.local_surface_id(),
|
| + MakeCompositorFrame({child_id2}, {child_id2},
|
| + TransferableResourceArray()));
|
|
|
| // child_support1 should now be blocked on |child_id2|.
|
| EXPECT_TRUE(dependency_tracker().has_deadline());
|
| @@ -359,7 +283,9 @@ TEST_F(CompositorFrameSinkSupportTest, DisplayCompositorLockingBlockedChain) {
|
| // Submit a CompositorFrame without any dependencies to |child_id2|.
|
| // parent_support should be activated.
|
| child_support2().SubmitCompositorFrame(
|
| - child_id2.local_surface_id(), MakeCompositorFrame(empty_surface_ids()));
|
| + child_id2.local_surface_id(),
|
| + MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
|
| + TransferableResourceArray()));
|
|
|
| EXPECT_FALSE(dependency_tracker().has_deadline());
|
|
|
| @@ -381,14 +307,15 @@ TEST_F(CompositorFrameSinkSupportTest, DisplayCompositorLockingBlockedChain) {
|
| }
|
|
|
| // parent_surface and child_surface1 are blocked on |child_id2|.
|
| -TEST_F(CompositorFrameSinkSupportTest,
|
| - DisplayCompositorLockingTwoBlockedOnOne) {
|
| +TEST_F(SurfaceSynchronizationTest, TwoBlockedOnOne) {
|
| const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
|
| const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1);
|
|
|
| - parent_support().SubmitCompositorFrame(parent_id.local_surface_id(),
|
| - MakeCompositorFrame({child_id2}));
|
| + parent_support().SubmitCompositorFrame(
|
| + parent_id.local_surface_id(),
|
| + MakeCompositorFrame({child_id2}, {child_id2},
|
| + TransferableResourceArray()));
|
|
|
| // parent_support is blocked on |child_id2|.
|
| EXPECT_TRUE(dependency_tracker().has_deadline());
|
| @@ -398,8 +325,10 @@ TEST_F(CompositorFrameSinkSupportTest,
|
| UnorderedElementsAre(child_id2));
|
|
|
| // child_support1 should now be blocked on |child_id2|.
|
| - child_support1().SubmitCompositorFrame(child_id1.local_surface_id(),
|
| - MakeCompositorFrame({child_id2}));
|
| + child_support1().SubmitCompositorFrame(
|
| + child_id1.local_surface_id(),
|
| + MakeCompositorFrame({child_id2}, {child_id2},
|
| + TransferableResourceArray()));
|
|
|
| EXPECT_TRUE(dependency_tracker().has_deadline());
|
| EXPECT_FALSE(child_surface1()->HasActiveFrame());
|
| @@ -414,7 +343,9 @@ TEST_F(CompositorFrameSinkSupportTest,
|
| // Submit a CompositorFrame without any dependencies to |child_id2|.
|
| // parent_support should be activated.
|
| child_support2().SubmitCompositorFrame(
|
| - child_id2.local_surface_id(), MakeCompositorFrame(empty_surface_ids()));
|
| + child_id2.local_surface_id(),
|
| + MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
|
| + TransferableResourceArray()));
|
|
|
| EXPECT_FALSE(dependency_tracker().has_deadline());
|
|
|
| @@ -431,13 +362,15 @@ TEST_F(CompositorFrameSinkSupportTest,
|
|
|
| // parent_surface is blocked on |child_id1|, and child_surface2 is blocked on
|
| // |child_id2| until the deadline hits.
|
| -TEST_F(CompositorFrameSinkSupportTest, DisplayCompositorLockingDeadlineHits) {
|
| +TEST_F(SurfaceSynchronizationTest, DeadlineHits) {
|
| const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
|
| const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1);
|
|
|
| - parent_support().SubmitCompositorFrame(parent_id.local_surface_id(),
|
| - MakeCompositorFrame({child_id1}));
|
| + parent_support().SubmitCompositorFrame(
|
| + parent_id.local_surface_id(),
|
| + MakeCompositorFrame({child_id1}, {child_id1},
|
| + TransferableResourceArray()));
|
|
|
| // parent_support is blocked on |child_id1|.
|
| EXPECT_TRUE(dependency_tracker().has_deadline());
|
| @@ -446,8 +379,10 @@ TEST_F(CompositorFrameSinkSupportTest, DisplayCompositorLockingDeadlineHits) {
|
| EXPECT_THAT(parent_surface()->blocking_surfaces(),
|
| UnorderedElementsAre(child_id1));
|
|
|
| - child_support1().SubmitCompositorFrame(child_id1.local_surface_id(),
|
| - MakeCompositorFrame({child_id2}));
|
| + child_support1().SubmitCompositorFrame(
|
| + child_id1.local_surface_id(),
|
| + MakeCompositorFrame({child_id2}, {child_id2},
|
| + TransferableResourceArray()));
|
|
|
| // child_support1 should now be blocked on |child_id2|.
|
| EXPECT_TRUE(dependency_tracker().has_deadline());
|
| @@ -499,15 +434,15 @@ TEST_F(CompositorFrameSinkSupportTest, DisplayCompositorLockingDeadlineHits) {
|
|
|
| // Verifies that the deadline does not reset if we submit CompositorFrames
|
| // to new Surfaces with unresolved dependencies.
|
| -TEST_F(CompositorFrameSinkSupportTest,
|
| - DisplayCompositorLockingFramesSubmittedAfterDeadlineSet) {
|
| +TEST_F(SurfaceSynchronizationTest, FramesSubmittedAfterDeadlineSet) {
|
| const SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1);
|
| BeginFrameArgs args =
|
| CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1);
|
| for (int i = 0; i < 3; ++i) {
|
| LocalSurfaceId local_surface_id(1, base::UnguessableToken::Create());
|
| - support(i).SubmitCompositorFrame(local_surface_id,
|
| - MakeCompositorFrame({arbitrary_id}));
|
| + support(i).SubmitCompositorFrame(
|
| + local_surface_id, MakeCompositorFrame({arbitrary_id}, {arbitrary_id},
|
| + TransferableResourceArray()));
|
| // The deadline has been set.
|
| EXPECT_TRUE(dependency_tracker().has_deadline());
|
|
|
| @@ -532,14 +467,15 @@ TEST_F(CompositorFrameSinkSupportTest,
|
|
|
| // This test verifies at the Surface activates once a CompositorFrame is
|
| // submitted that has no unresolved dependencies.
|
| -TEST_F(CompositorFrameSinkSupportTest,
|
| - DisplayCompositorLockingNewFrameOverridesOldDependencies) {
|
| +TEST_F(SurfaceSynchronizationTest, NewFrameOverridesOldDependencies) {
|
| const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1);
|
|
|
| // Submit a CompositorFrame that depends on |arbitrary_id|.
|
| - parent_support().SubmitCompositorFrame(parent_id.local_surface_id(),
|
| - MakeCompositorFrame({arbitrary_id}));
|
| + parent_support().SubmitCompositorFrame(
|
| + parent_id.local_surface_id(),
|
| + MakeCompositorFrame({arbitrary_id}, {arbitrary_id},
|
| + TransferableResourceArray()));
|
|
|
| // Verify that the CompositorFrame is blocked on |arbitrary_id|.
|
| EXPECT_FALSE(parent_surface()->HasActiveFrame());
|
| @@ -549,7 +485,9 @@ TEST_F(CompositorFrameSinkSupportTest,
|
|
|
| // Submit a CompositorFrame that has no dependencies.
|
| parent_support().SubmitCompositorFrame(
|
| - parent_id.local_surface_id(), MakeCompositorFrame(empty_surface_ids()));
|
| + parent_id.local_surface_id(),
|
| + MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
|
| + TransferableResourceArray()));
|
|
|
| // Verify that the CompositorFrame has been activated.
|
| EXPECT_TRUE(parent_surface()->HasActiveFrame());
|
| @@ -560,8 +498,7 @@ TEST_F(CompositorFrameSinkSupportTest,
|
| // This test verifies that a pending CompositorFrame does not affect surface
|
| // references. A new surface from a child will continue to exist as a temporary
|
| // reference until the parent's frame activates.
|
| -TEST_F(CompositorFrameSinkSupportTest,
|
| - OnlyActiveFramesAffectSurfaceReferences) {
|
| +TEST_F(SurfaceSynchronizationTest, OnlyActiveFramesAffectSurfaceReferences) {
|
| const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
|
| const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1);
|
| @@ -589,7 +526,8 @@ TEST_F(CompositorFrameSinkSupportTest,
|
| EXPECT_CALL(support_client_, DidReceiveCompositorFrameAck(_)).Times(0);
|
| parent_support().SubmitCompositorFrame(
|
| parent_id.local_surface_id(),
|
| - MakeCompositorFrame({child_id1, child_id2}));
|
| + MakeCompositorFrame({child_id1, child_id2}, {child_id1, child_id2},
|
| + TransferableResourceArray()));
|
| EXPECT_FALSE(parent_surface()->HasActiveFrame());
|
| EXPECT_TRUE(parent_surface()->HasPendingFrame());
|
| EXPECT_THAT(parent_surface()->blocking_surfaces(),
|
| @@ -627,21 +565,22 @@ TEST_F(CompositorFrameSinkSupportTest,
|
| // This test verifies that we do not double count returned resources when a
|
| // CompositorFrame starts out as pending, then becomes active, and then is
|
| // replaced with another active CompositorFrame.
|
| -TEST_F(CompositorFrameSinkSupportTest,
|
| - DisplayCompositorLockingResourcesOnlyReturnedOnce) {
|
| +TEST_F(SurfaceSynchronizationTest, ResourcesOnlyReturnedOnce) {
|
| const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1);
|
|
|
| // The parent submits a CompositorFrame that depends on |child_id| before the
|
| // child submits a CompositorFrame. The CompositorFrame also has resources in
|
| // its resource list.
|
| - TransferableResource resource =
|
| - MakeResource(1337 /* id */, ALPHA_8 /* format */, 1234 /* filter */,
|
| - gfx::Size(1234, 5678));
|
| + TransferableResource resource;
|
| + resource.id = 1337;
|
| + resource.format = ALPHA_8;
|
| + resource.filter = 1234;
|
| + resource.size = gfx::Size(1234, 5678);
|
| TransferableResourceArray resource_list = {resource};
|
| parent_support().SubmitCompositorFrame(
|
| parent_id.local_surface_id(),
|
| - MakeCompositorFrameWithResources({child_id}, resource_list));
|
| + MakeCompositorFrame({child_id}, {child_id}, resource_list));
|
|
|
| // Verify that the CompositorFrame is blocked on |child_id|.
|
| EXPECT_FALSE(parent_surface()->HasActiveFrame());
|
| @@ -650,7 +589,9 @@ TEST_F(CompositorFrameSinkSupportTest,
|
| UnorderedElementsAre(child_id));
|
|
|
| child_support1().SubmitCompositorFrame(
|
| - child_id.local_surface_id(), MakeCompositorFrame(empty_surface_ids()));
|
| + child_id.local_surface_id(),
|
| + MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
|
| + TransferableResourceArray()));
|
|
|
| // Verify that the child CompositorFrame activates immediately.
|
| EXPECT_TRUE(child_surface1()->HasActiveFrame());
|
| @@ -662,30 +603,35 @@ TEST_F(CompositorFrameSinkSupportTest,
|
| EXPECT_FALSE(parent_surface()->HasPendingFrame());
|
| EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty());
|
|
|
| + ReturnedResourceArray returned_resources = {resource.ToReturnedResource()};
|
| + EXPECT_CALL(support_client_,
|
| + DidReceiveCompositorFrameAck(returned_resources));
|
| +
|
| // The parent submits a CompositorFrame without any dependencies. That frame
|
| // should activate immediately, replacing the earlier frame. The resource from
|
| // the earlier frame should be returned to the client.
|
| parent_support().SubmitCompositorFrame(
|
| - parent_id.local_surface_id(), MakeCompositorFrame({empty_surface_ids()}));
|
| + parent_id.local_surface_id(),
|
| + MakeCompositorFrame({empty_surface_ids()}, {empty_surface_ids()},
|
| + TransferableResourceArray()));
|
| EXPECT_TRUE(parent_surface()->HasActiveFrame());
|
| EXPECT_FALSE(parent_surface()->HasPendingFrame());
|
| EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty());
|
| - ReturnedResource returned_resource = resource.ToReturnedResource();
|
| - EXPECT_THAT(support_client_.last_returned_resources(),
|
| - UnorderedElementsAre(returned_resource));
|
| }
|
|
|
| // The parent Surface is blocked on |child_id2| which is blocked on |child_id3|.
|
| // child_support1 evicts its blocked Surface. The parent surface should
|
| // activate.
|
| -TEST_F(CompositorFrameSinkSupportTest, EvictSurfaceWithPendingFrame) {
|
| +TEST_F(SurfaceSynchronizationTest, EvictSurfaceWithPendingFrame) {
|
| const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
|
| const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1);
|
|
|
| // Submit a CompositorFrame that depends on |child_id1|.
|
| - parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(),
|
| - MakeCompositorFrame({child_id1}));
|
| + parent_support().SubmitCompositorFrame(
|
| + parent_id1.local_surface_id(),
|
| + MakeCompositorFrame({child_id1}, {child_id1},
|
| + TransferableResourceArray()));
|
|
|
| // Verify that the CompositorFrame is blocked on |child_id1|.
|
| EXPECT_FALSE(parent_surface()->HasActiveFrame());
|
| @@ -694,8 +640,10 @@ TEST_F(CompositorFrameSinkSupportTest, EvictSurfaceWithPendingFrame) {
|
| UnorderedElementsAre(child_id1));
|
|
|
| // Submit a CompositorFrame that depends on |child_id2|.
|
| - child_support1().SubmitCompositorFrame(child_id1.local_surface_id(),
|
| - MakeCompositorFrame({child_id2}));
|
| + child_support1().SubmitCompositorFrame(
|
| + child_id1.local_surface_id(),
|
| + MakeCompositorFrame({child_id2}, {child_id2},
|
| + TransferableResourceArray()));
|
|
|
| // Verify that the CompositorFrame is blocked on |child_id2|.
|
| EXPECT_FALSE(child_surface1()->HasActiveFrame());
|
| @@ -719,7 +667,7 @@ TEST_F(CompositorFrameSinkSupportTest, EvictSurfaceWithPendingFrame) {
|
| // existing active CompositorFrame, then the surface reference hierarchy will be
|
| // updated allowing garbage collection of surfaces that are no longer
|
| // referenced.
|
| -TEST_F(CompositorFrameSinkSupportTest, DropStaleReferencesAfterActivation) {
|
| +TEST_F(SurfaceSynchronizationTest, DropStaleReferencesAfterActivation) {
|
| const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
|
| const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1);
|
| @@ -727,8 +675,10 @@ TEST_F(CompositorFrameSinkSupportTest, DropStaleReferencesAfterActivation) {
|
| // The parent submits a CompositorFrame that depends on |child_id1| before the
|
| // child submits a CompositorFrame.
|
| EXPECT_CALL(support_client_, DidReceiveCompositorFrameAck(_)).Times(0);
|
| - parent_support().SubmitCompositorFrame(parent_id.local_surface_id(),
|
| - MakeCompositorFrame({child_id1}));
|
| + parent_support().SubmitCompositorFrame(
|
| + parent_id.local_surface_id(),
|
| + MakeCompositorFrame({child_id1}, {child_id1},
|
| + TransferableResourceArray()));
|
|
|
| // Verify that the CompositorFrame is blocked on |child_id|.
|
| EXPECT_FALSE(parent_surface()->HasActiveFrame());
|
| @@ -744,7 +694,9 @@ TEST_F(CompositorFrameSinkSupportTest, DropStaleReferencesAfterActivation) {
|
| // and once for the now active parent CompositorFrame.
|
| EXPECT_CALL(support_client_, DidReceiveCompositorFrameAck(_)).Times(2);
|
| child_support1().SubmitCompositorFrame(
|
| - child_id1.local_surface_id(), MakeCompositorFrame(empty_surface_ids()));
|
| + child_id1.local_surface_id(),
|
| + MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
|
| + TransferableResourceArray()));
|
| testing::Mock::VerifyAndClearExpectations(&support_client_);
|
|
|
| // Verify that the child CompositorFrame activates immediately.
|
| @@ -765,8 +717,10 @@ TEST_F(CompositorFrameSinkSupportTest, DropStaleReferencesAfterActivation) {
|
| // The parent submits another CompositorFrame that depends on |child_id2|.
|
| // Submitting a pending CompositorFrame will not trigger a CompositorFrameAck.
|
| EXPECT_CALL(support_client_, DidReceiveCompositorFrameAck(_)).Times(0);
|
| - parent_support().SubmitCompositorFrame(parent_id.local_surface_id(),
|
| - MakeCompositorFrame({child_id2}));
|
| + parent_support().SubmitCompositorFrame(
|
| + parent_id.local_surface_id(),
|
| + MakeCompositorFrame({child_id2}, {child_id2},
|
| + TransferableResourceArray()));
|
| testing::Mock::VerifyAndClearExpectations(&support_client_);
|
|
|
| // The parent surface should now have both a pending and activate
|
| @@ -779,7 +733,9 @@ TEST_F(CompositorFrameSinkSupportTest, DropStaleReferencesAfterActivation) {
|
| EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id1));
|
|
|
| child_support2().SubmitCompositorFrame(
|
| - child_id2.local_surface_id(), MakeCompositorFrame(empty_surface_ids()));
|
| + child_id2.local_surface_id(),
|
| + MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
|
| + TransferableResourceArray()));
|
|
|
| // Verify that the parent Surface has activated and no longer has a pending
|
| // CompositorFrame. Also verify that |child_id1| is no longer a child
|
| @@ -792,7 +748,7 @@ TEST_F(CompositorFrameSinkSupportTest, DropStaleReferencesAfterActivation) {
|
|
|
| // Checks whether the latency info are moved to the new surface from the old
|
| // one when LocalSurfaceId changes. No frame has unresolved dependencies.
|
| -TEST_F(CompositorFrameSinkSupportTest,
|
| +TEST_F(SurfaceSynchronizationTest,
|
| LatencyInfoCarriedOverOnResize_NoUnresolvedDependencies) {
|
| const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2);
|
| @@ -862,7 +818,7 @@ TEST_F(CompositorFrameSinkSupportTest,
|
|
|
| // Checks whether the latency info are moved to the new surface from the old
|
| // one when LocalSurfaceId changes. Old surface has unresolved dependencies.
|
| -TEST_F(CompositorFrameSinkSupportTest,
|
| +TEST_F(SurfaceSynchronizationTest,
|
| LatencyInfoCarriedOverOnResize_OldSurfaceHasPendingAndActiveFrame) {
|
| const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2);
|
| @@ -890,7 +846,8 @@ TEST_F(CompositorFrameSinkSupportTest,
|
| ui::LatencyInfo info2;
|
| info2.AddLatencyNumber(latency_type2, latency_id2, latency_sequence_number2);
|
|
|
| - CompositorFrame frame2 = MakeCompositorFrame({child_id});
|
| + CompositorFrame frame2 =
|
| + MakeCompositorFrame({child_id}, {child_id}, TransferableResourceArray());
|
| frame2.metadata.latency_info.push_back(info2);
|
|
|
| parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(),
|
| @@ -938,7 +895,7 @@ TEST_F(CompositorFrameSinkSupportTest,
|
|
|
| // Checks whether the latency info are moved to the new surface from the old
|
| // one when LocalSurfaceId changes. The new surface has unresolved dependencies.
|
| -TEST_F(CompositorFrameSinkSupportTest,
|
| +TEST_F(SurfaceSynchronizationTest,
|
| LatencyInfoCarriedOverOnResize_NewSurfaceHasPendingFrame) {
|
| const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2);
|
| @@ -973,7 +930,8 @@ TEST_F(CompositorFrameSinkSupportTest,
|
| ui::LatencyInfo info2;
|
| info2.AddLatencyNumber(latency_type2, latency_id2, latency_sequence_number2);
|
|
|
| - CompositorFrame frame2 = MakeCompositorFrame({child_id});
|
| + CompositorFrame frame2 =
|
| + MakeCompositorFrame({child_id}, {child_id}, TransferableResourceArray());
|
| frame2.metadata.latency_info.push_back(info2);
|
|
|
| parent_support().SubmitCompositorFrame(parent_id2.local_surface_id(),
|
| @@ -1015,7 +973,7 @@ TEST_F(CompositorFrameSinkSupportTest,
|
| ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, nullptr));
|
| }
|
|
|
| -TEST_F(CompositorFrameSinkSupportTest, PassesOnBeginFrameAcks) {
|
| +TEST_F(SurfaceSynchronizationTest, PassesOnBeginFrameAcks) {
|
| const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1);
|
|
|
| // Request BeginFrames.
|
| @@ -1047,13 +1005,14 @@ TEST_F(CompositorFrameSinkSupportTest, PassesOnBeginFrameAcks) {
|
| }
|
|
|
| // Checks that resources and ack are sent together if possible.
|
| -TEST_F(CompositorFrameSinkSupportTest, ReturnResourcesWithAck) {
|
| +TEST_F(SurfaceSynchronizationTest, ReturnResourcesWithAck) {
|
| const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
|
| TransferableResource resource;
|
| resource.id = 1234;
|
| parent_support().SubmitCompositorFrame(
|
| parent_id.local_surface_id(),
|
| - MakeCompositorFrameWithResources(empty_surface_ids(), {resource}));
|
| + MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
|
| + {resource}));
|
| ReturnedResourceArray returned_resources;
|
| TransferableResource::ReturnResources({resource}, &returned_resources);
|
| EXPECT_CALL(support_client_, ReclaimResources(_)).Times(0);
|
| @@ -1065,13 +1024,14 @@ TEST_F(CompositorFrameSinkSupportTest, ReturnResourcesWithAck) {
|
|
|
| // Verifies that if a surface is marked destroyed and a new frame arrives for
|
| // it, it will be recovered.
|
| -TEST_F(CompositorFrameSinkSupportTest, SurfaceResurrection) {
|
| +TEST_F(SurfaceSynchronizationTest, SurfaceResurrection) {
|
| const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 3);
|
|
|
| // Add a reference from the parent to the child.
|
| - parent_support().SubmitCompositorFrame(parent_id.local_surface_id(),
|
| - MakeCompositorFrame({child_id}));
|
| + parent_support().SubmitCompositorFrame(
|
| + parent_id.local_surface_id(),
|
| + MakeCompositorFrame({child_id}, {child_id}, TransferableResourceArray()));
|
|
|
| // Create the child surface by submitting a frame to it.
|
| EXPECT_EQ(nullptr, surface_manager().GetSurfaceForId(child_id));
|
| @@ -1103,13 +1063,14 @@ TEST_F(CompositorFrameSinkSupportTest, SurfaceResurrection) {
|
|
|
| // Verifies that if a LocalSurfaceId belonged to a surface that doesn't exist
|
| // anymore, it can still be reused for new surfaces.
|
| -TEST_F(CompositorFrameSinkSupportTest, LocalSurfaceIdIsReusable) {
|
| +TEST_F(SurfaceSynchronizationTest, LocalSurfaceIdIsReusable) {
|
| const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 3);
|
|
|
| // Add a reference from parent.
|
| - parent_support().SubmitCompositorFrame(parent_id.local_surface_id(),
|
| - MakeCompositorFrame({child_id}));
|
| + parent_support().SubmitCompositorFrame(
|
| + parent_id.local_surface_id(),
|
| + MakeCompositorFrame({child_id}, {child_id}, TransferableResourceArray()));
|
|
|
| // Submit the first frame. Creates the surface.
|
| child_support1().SubmitCompositorFrame(child_id.local_surface_id(),
|
| @@ -1138,16 +1099,19 @@ TEST_F(CompositorFrameSinkSupportTest, LocalSurfaceIdIsReusable) {
|
| // activated subtree refer to the same dependency. The old subtree was activated
|
| // by deadline, and the new subtree was activated by a dependency finally
|
| // resolving.
|
| -TEST_F(CompositorFrameSinkSupportTest, DependencyTrackingGarbageCollection) {
|
| +TEST_F(SurfaceSynchronizationTest, DependencyTrackingGarbageCollection) {
|
| const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1);
|
| const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2);
|
| const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1);
|
|
|
| - parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(),
|
| - MakeCompositorFrame({child_id}));
|
| - display_support().SubmitCompositorFrame(display_id.local_surface_id(),
|
| - MakeCompositorFrame({parent_id1}));
|
| + parent_support().SubmitCompositorFrame(
|
| + parent_id1.local_surface_id(),
|
| + MakeCompositorFrame({child_id}, {child_id}, TransferableResourceArray()));
|
| + display_support().SubmitCompositorFrame(
|
| + display_id.local_surface_id(),
|
| + MakeCompositorFrame({parent_id1}, {parent_id1},
|
| + TransferableResourceArray()));
|
|
|
| EXPECT_TRUE(dependency_tracker().has_deadline());
|
|
|
| @@ -1167,10 +1131,13 @@ TEST_F(CompositorFrameSinkSupportTest, DependencyTrackingGarbageCollection) {
|
| EXPECT_TRUE(parent_surface()->HasActiveFrame());
|
| EXPECT_FALSE(parent_surface()->HasPendingFrame());
|
|
|
| - parent_support().SubmitCompositorFrame(parent_id2.local_surface_id(),
|
| - MakeCompositorFrame({child_id}));
|
| - display_support().SubmitCompositorFrame(display_id.local_surface_id(),
|
| - MakeCompositorFrame({parent_id2}));
|
| + parent_support().SubmitCompositorFrame(
|
| + parent_id2.local_surface_id(),
|
| + MakeCompositorFrame({child_id}, {child_id}, TransferableResourceArray()));
|
| + display_support().SubmitCompositorFrame(
|
| + display_id.local_surface_id(),
|
| + MakeCompositorFrame({parent_id2}, {parent_id2},
|
| + TransferableResourceArray()));
|
|
|
| // The display surface now has two CompositorFrames. One that is pending,
|
| // indirectly blocked on child_id and one that is active, also indirectly
|
| @@ -1181,7 +1148,9 @@ TEST_F(CompositorFrameSinkSupportTest, DependencyTrackingGarbageCollection) {
|
| // Submitting a CompositorFrame will trigger garbage collection of the
|
| // |parent_id1| subtree. This should not crash.
|
| child_support1().SubmitCompositorFrame(
|
| - child_id.local_surface_id(), MakeCompositorFrame(empty_surface_ids()));
|
| + child_id.local_surface_id(),
|
| + MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
|
| + TransferableResourceArray()));
|
| }
|
|
|
| // This test verifies that a crash does not occur if garbage collection is
|
| @@ -1192,14 +1161,16 @@ TEST_F(CompositorFrameSinkSupportTest, DependencyTrackingGarbageCollection) {
|
| // deadline activation. SurfaceDependencyTracker is also tracking a surface
|
| // from that subtree due to an unresolved dependency. This test verifies that
|
| // this dependency resolution does not crash.
|
| -TEST_F(CompositorFrameSinkSupportTest, GarbageCollectionOnDeadline) {
|
| +TEST_F(SurfaceSynchronizationTest, GarbageCollectionOnDeadline) {
|
| const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1);
|
| const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2);
|
| const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1);
|
|
|
| - display_support().SubmitCompositorFrame(display_id.local_surface_id(),
|
| - MakeCompositorFrame({parent_id1}));
|
| + display_support().SubmitCompositorFrame(
|
| + display_id.local_surface_id(),
|
| + MakeCompositorFrame({parent_id1}, {parent_id1},
|
| + TransferableResourceArray()));
|
|
|
| EXPECT_TRUE(display_surface()->HasPendingFrame());
|
| EXPECT_TRUE(dependency_tracker().has_deadline());
|
| @@ -1221,18 +1192,22 @@ TEST_F(CompositorFrameSinkSupportTest, GarbageCollectionOnDeadline) {
|
| // |parent_id1| is blocked on |child_id|, but |display_id|'s CompositorFrame
|
| // has activated due to a deadline. |parent_id1| will be tracked by the
|
| // SurfaceDependencyTracker.
|
| - parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(),
|
| - MakeCompositorFrame({child_id}));
|
| + parent_support().SubmitCompositorFrame(
|
| + parent_id1.local_surface_id(),
|
| + MakeCompositorFrame({child_id}, {child_id}, TransferableResourceArray()));
|
|
|
| // By submitting a display CompositorFrame, and replacing the parent's
|
| // CompositorFrame with another surface ID, parent_id1 becomes unreachable and
|
| // a candidate for garbage collection.
|
| - display_support().SubmitCompositorFrame(display_id.local_surface_id(),
|
| - MakeCompositorFrame({parent_id2}));
|
| + display_support().SubmitCompositorFrame(
|
| + display_id.local_surface_id(),
|
| + MakeCompositorFrame({parent_id2}, {parent_id2},
|
| + TransferableResourceArray()));
|
|
|
| // Now |parent_id1| is only kept alive by the active |display_id| frame.
|
| - parent_support().SubmitCompositorFrame(parent_id2.local_surface_id(),
|
| - MakeCompositorFrame({child_id}));
|
| + parent_support().SubmitCompositorFrame(
|
| + parent_id2.local_surface_id(),
|
| + MakeCompositorFrame({child_id}, {child_id}, TransferableResourceArray()));
|
|
|
| // SurfaceDependencyTracker should now be tracking |display_id|, |parent_id1|
|
| // and |parent_id2|. By activating the pending |display_id| frame by deadline,
|
| @@ -1249,14 +1224,15 @@ TEST_F(CompositorFrameSinkSupportTest, GarbageCollectionOnDeadline) {
|
|
|
| // This test verifies that a CompositorFrame will only blocked on embedded
|
| // surfaces but not on other retained surface IDs in the CompositorFrame.
|
| -TEST_F(CompositorFrameSinkSupportTest, OnlyBlockOnEmbeddedSurfaces) {
|
| +TEST_F(SurfaceSynchronizationTest, OnlyBlockOnEmbeddedSurfaces) {
|
| const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1);
|
| const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2);
|
|
|
| display_support().SubmitCompositorFrame(
|
| display_id.local_surface_id(),
|
| - MakeCompositorFrame({parent_id1}, {parent_id1, parent_id2}));
|
| + MakeCompositorFrame({parent_id1}, {parent_id1, parent_id2},
|
| + TransferableResourceArray()));
|
|
|
| EXPECT_TRUE(display_surface()->HasPendingFrame());
|
| EXPECT_FALSE(display_surface()->HasActiveFrame());
|
| @@ -1287,13 +1263,15 @@ TEST_F(CompositorFrameSinkSupportTest, OnlyBlockOnEmbeddedSurfaces) {
|
|
|
| // This test verifies that a late arriving CompositorFrame activates immediately
|
| // and does not trigger a new deadline.
|
| -TEST_F(CompositorFrameSinkSupportTest, LateArrivingDependency) {
|
| +TEST_F(SurfaceSynchronizationTest, LateArrivingDependency) {
|
| const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1);
|
| const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
|
| const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
|
|
|
| - display_support().SubmitCompositorFrame(display_id.local_surface_id(),
|
| - MakeCompositorFrame({parent_id1}));
|
| + display_support().SubmitCompositorFrame(
|
| + display_id.local_surface_id(),
|
| + MakeCompositorFrame({parent_id1}, {parent_id1},
|
| + TransferableResourceArray()));
|
|
|
| EXPECT_TRUE(display_surface()->HasPendingFrame());
|
| EXPECT_FALSE(display_surface()->HasActiveFrame());
|
| @@ -1314,8 +1292,10 @@ TEST_F(CompositorFrameSinkSupportTest, LateArrivingDependency) {
|
|
|
| // A late arriving CompositorFrame should activate immediately without
|
| // scheduling a deadline and without waiting for dependencies to resolve.
|
| - parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(),
|
| - MakeCompositorFrame({child_id1}));
|
| + parent_support().SubmitCompositorFrame(
|
| + parent_id1.local_surface_id(),
|
| + MakeCompositorFrame({child_id1}, {child_id1},
|
| + TransferableResourceArray()));
|
| EXPECT_FALSE(dependency_tracker().has_deadline());
|
| EXPECT_FALSE(parent_surface()->HasPendingFrame());
|
| EXPECT_TRUE(parent_surface()->HasActiveFrame());
|
|
|