| 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 027022e8bc66d2b86487e1ffd7c8127a2591e7a8..59b8fca6344740205a565ed53241c2640ba0f8af 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/compositor_frame_helpers.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,66 +41,14 @@ SurfaceId MakeSurfaceId(const FrameSinkId& frame_sink_id, uint32_t local_id) {
|
| LocalSurfaceId(local_id, base::UnguessableToken::Deserialize(0, 1u)));
|
| }
|
|
|
| -CompositorFrame MakeCompositorFrame(
|
| - std::vector<SurfaceId> activation_dependencies,
|
| - std::vector<SurfaceId> referenced_surfaces,
|
| - TransferableResourceArray resource_list) {
|
| - CompositorFrame compositor_frame = test::MakeCompositorFrame();
|
| - compositor_frame.metadata.begin_frame_ack = BeginFrameAck(0, 1, 1, true);
|
| - compositor_frame.metadata.activation_dependencies =
|
| - std::move(activation_dependencies);
|
| - 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> activation_dependencies) {
|
| - return MakeCompositorFrame(activation_dependencies, activation_dependencies,
|
| - TransferableResourceArray());
|
| -}
|
| -
|
| -CompositorFrame MakeCompositorFrame(
|
| - std::vector<SurfaceId> activation_dependencies,
|
| - std::vector<SurfaceId> referenced_surfaces) {
|
| - return MakeCompositorFrame(std::move(activation_dependencies),
|
| - std::move(referenced_surfaces),
|
| - TransferableResourceArray());
|
| -}
|
| -
|
| -CompositorFrame MakeCompositorFrameWithResources(
|
| - std::vector<SurfaceId> activation_dependencies,
|
| - TransferableResourceArray resource_list) {
|
| - return MakeCompositorFrame(activation_dependencies, activation_dependencies,
|
| - 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()
|
| + SurfaceSynchronizationTest()
|
| : surface_manager_(SurfaceManager::LifetimeType::REFERENCES) {}
|
| - ~CompositorFrameSinkSupportTest() override {}
|
| + ~SurfaceSynchronizationTest() override {}
|
|
|
| CompositorFrameSinkSupport& display_support() { return *supports_[0]; }
|
| Surface* display_surface() {
|
| @@ -188,10 +102,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(
|
| @@ -199,17 +110,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,
|
| @@ -252,12 +163,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);
|
|
|
| @@ -286,14 +197,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());
|
| @@ -305,7 +217,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());
|
| @@ -316,7 +230,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());
|
| @@ -325,13 +241,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());
|
| @@ -342,8 +260,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());
|
| @@ -362,7 +282,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());
|
|
|
| @@ -384,14 +306,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());
|
| @@ -401,8 +324,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());
|
| @@ -417,7 +342,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());
|
|
|
| @@ -434,13 +361,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());
|
| @@ -449,8 +378,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());
|
| @@ -502,15 +433,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());
|
|
|
| @@ -535,14 +466,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());
|
| @@ -552,7 +484,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());
|
| @@ -563,8 +497,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);
|
| @@ -592,7 +525,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(),
|
| @@ -630,21 +564,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());
|
| @@ -653,7 +588,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());
|
| @@ -665,30 +602,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());
|
| @@ -697,8 +639,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());
|
| @@ -722,7 +666,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);
|
| @@ -730,8 +674,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());
|
| @@ -747,7 +693,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.
|
| @@ -768,8 +716,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
|
| @@ -782,7 +732,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
|
| @@ -795,7 +747,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);
|
| @@ -865,7 +817,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);
|
| @@ -893,7 +845,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(),
|
| @@ -941,7 +894,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);
|
| @@ -976,7 +929,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(),
|
| @@ -1018,7 +972,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.
|
| @@ -1050,13 +1004,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);
|
| @@ -1068,13 +1023,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));
|
| @@ -1106,13 +1062,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(),
|
| @@ -1141,16 +1098,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());
|
|
|
| @@ -1170,10 +1130,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
|
| @@ -1184,7 +1147,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
|
| @@ -1195,14 +1160,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());
|
| @@ -1224,18 +1191,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,
|
| @@ -1252,14 +1223,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());
|
| @@ -1290,13 +1262,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());
|
| @@ -1317,11 +1291,14 @@ 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());
|
| }
|
|
|
| +} // namespace test
|
| } // namespace cc
|
|
|