#include "third_party/blink/renderer/platform/graphics/video_frame_sink_bundle.h"
#include <memory>
#include <tuple>
#include <utility>
#include "base/run_loop.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "base/unguessable_token.h"
#include "components/viz/common/frame_sinks/begin_frame_args.h"
#include "components/viz/common/frame_timing_details.h"
#include "components/viz/common/surfaces/frame_sink_bundle_id.h"
#include "components/viz/common/surfaces/frame_sink_id.h"
#include "components/viz/common/surfaces/local_surface_id.h"
#include "components/viz/test/compositor_frame_helpers.h"
#include "services/viz/public/mojom/compositing/frame_sink_bundle.mojom-blink.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/graphics/test/mock_compositor_frame_sink.h"
#include "third_party/blink/renderer/platform/graphics/test/mock_compositor_frame_sink_client.h"
#include "third_party/blink/renderer/platform/graphics/test/mock_embedded_frame_sink_provider.h"
#include "third_party/blink/renderer/platform/graphics/test/mock_frame_sink_bundle.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink {
namespace {
AllOf;
ElementsAre;
UnorderedElementsAre;
const uint32_t kTestClientId = …;
const viz::FrameSinkId kTestVideoSinkId1(kTestClientId, 2);
const viz::FrameSinkId kTestVideoSinkId2(kTestClientId, 3);
const viz::FrameSinkId kTestVideoSinkId3(kTestClientId, 4);
class MockBeginFrameObserver : public VideoFrameSinkBundle::BeginFrameObserver { … };
MATCHER(IsEmpty, "") { … }
MATCHER(IsFrame, "") { … }
MATCHER(IsDidNotProduceFrame, "") { … }
MATCHER_P(ForSink, sink_id, "") { … }
viz::mojom::blink::BeginFrameInfoPtr MakeBeginFrameInfo(uint32_t sink_id) { … }
class MockFrameSinkBundleClient
: public viz::mojom::blink::FrameSinkBundleClient { … };
const viz::LocalSurfaceId kTestSurfaceId(
1,
base::UnguessableToken::CreateForTesting(1, 2));
class VideoFrameSinkBundleTest : public testing::Test { … };
TEST_F(VideoFrameSinkBundleTest, GetOrCreateSharedInstance) { … }
TEST_F(VideoFrameSinkBundleTest, Reconnect) { … }
TEST_F(VideoFrameSinkBundleTest, PassThrough) { … }
TEST_F(VideoFrameSinkBundleTest, BatchSubmissionsDuringOnBeginFrame) { … }
TEST_F(VideoFrameSinkBundleTest,
DeliversBeginFramesDisabledWithoutSinksOnRegistration) { … }
TEST_F(VideoFrameSinkBundleTest,
DeliversBeginFramesEnabledWithSinkOnRegistration) { … }
TEST_F(VideoFrameSinkBundleTest, DeliversBeginFramesDisabledOnSinksDisabled) { … }
TEST_F(VideoFrameSinkBundleTest, DeliversBeginFramesEnabledOnSinkAdded) { … }
TEST_F(VideoFrameSinkBundleTest,
DeliversBeginFrameCompletionOnFlushWithBeginFrames) { … }
TEST_F(VideoFrameSinkBundleTest,
OmitsBeginFrameCompletionOnceOnFlushWithoutBeginFrames) { … }
}
}