chromium/components/viz/service/surfaces/surface_unittest.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <utility>

#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_tick_clock.h"
#include "cc/test/scheduler_test_common.h"
#include "components/viz/common/features.h"
#include "components/viz/common/frame_sinks/copy_output_result.h"
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
#include "components/viz/common/surfaces/subtree_capture_id.h"
#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h"
#include "components/viz/service/frame_sinks/compositor_frame_sink_support.h"
#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h"
#include "components/viz/service/surfaces/pending_copy_output_request.h"
#include "components/viz/service/surfaces/surface.h"
#include "components/viz/test/begin_frame_args_test.h"
#include "components/viz/test/compositor_frame_helpers.h"
#include "components/viz/test/fake_external_begin_frame_source.h"
#include "components/viz/test/mock_compositor_frame_sink_client.h"
#include "components/viz/test/test_surface_id_allocator.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/size.h"

namespace viz {
namespace {

constexpr FrameSinkId kArbitraryFrameSinkId(1, 1);
constexpr bool kIsRoot =;
const uint64_t kBeginFrameSourceId =;

class SurfaceTest : public testing::Test {};

// Supports testing features::OnBeginFrameAcks, which changes the expectations
// of what IPCs are sent to the CompositorFrameSinkClient. When enabled
// OnBeginFrame also handles ReturnResources as well as
// DidReceiveCompositorFrameAck.
class OnBeginFrameAcksSurfaceTest : public SurfaceTest,
                                    public testing::WithParamInterface<bool> {};

OnBeginFrameAcksSurfaceTest::OnBeginFrameAcksSurfaceTest() {}

TEST_P(OnBeginFrameAcksSurfaceTest, PresentationCallback) {}

INSTANTIATE_TEST_SUITE_P();

TEST_F(SurfaceTest, SurfaceIds) {}

void TestCopyResultCallback(bool* called,
                            base::OnceClosure finished,
                            std::unique_ptr<CopyOutputResult> result) {}

// Test that CopyOutputRequests can outlive the current frame and be
// aggregated on the next frame.
TEST_F(SurfaceTest, CopyRequestLifetime) {}

// Verify activate referenced surfaces is correct when there are two surface
// references to overlapping surface ranges. In particular the two surface
// ranges are (S1, S1) and (S1, S2). When both S1 and S2 activate active
// referenced surfaces should include both S1 and S2. See
// https://crbug.com/1275605 for more context.
TEST_F(SurfaceTest, ActiveSurfaceReferencesWithOverlappingReferences) {}

TEST_F(SurfaceTest, PendingCopySurfaceIncludedInActiveReferencedSurfaces) {}

// Parameterized by whether we should enable kDrawImmediatelyWhenInteractive.
class ImmediateActivationSurfaceTest
    : public SurfaceTest,
      public testing::WithParamInterface<bool> {};

INSTANTIATE_TEST_SUITE_P();

// Checks that submitting a compositor frame with a dependency always results in
// activation dependencies if we have no interaction.
TEST_P(ImmediateActivationSurfaceTest, WithNoInteraction) {}

// Checks that submitting a compositor frame with a dependency only results in
// activation dependencies if we haven't enabled immediate activation.
TEST_P(ImmediateActivationSurfaceTest, WithInteraction) {}

}  // namespace
}  // namespace viz