#include "third_party/blink/renderer/modules/mediarecorder/media_recorder_encoder_wrapper.h"
#include <memory>
#include "base/containers/heap_array.h"
#include "base/memory/raw_ptr.h"
#include "media/base/mock_filters.h"
#include "media/base/video_frame.h"
#include "media/video/gpu_video_accelerator_factories.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
_;
InSequence;
Invoke;
Return;
WithArgs;
namespace blink {
namespace {
constexpr uint32_t kDefaultBitrate = …;
constexpr gfx::Size k720p{ … };
constexpr gfx::Size k360p{ … };
constexpr size_t kChunkSize = …;
media::VideoEncoderOutput DefaultEncoderOutput() { … }
MATCHER_P3(MatchEncoderOptions,
bitrate,
frame_size,
content_hint,
"encoder option matcher") { … }
MATCHER_P(MatchEncodeOption, key_frame, "encode option matcher") { … }
MATCHER_P(MatchStringSize, data_size, "encode data size matcher") { … }
MATCHER_P2(MatchVideoParams,
visible_rect_size,
video_codec,
"video_params matcher") { … }
MATCHER_P(MatchErrorCode, code, "error code matcher") { … }
}
class MockVideoEncoderWrapper : public media::VideoEncoder { … };
class MediaRecorderEncoderWrapperTest
: public ::testing::TestWithParam<media::VideoCodecProfile> { … };
TEST_P(MediaRecorderEncoderWrapperTest, InitializesAndEncodesOneFrame) { … }
TEST_P(MediaRecorderEncoderWrapperTest,
InitializesWithScreenCastAndEncodesOneFrame) { … }
TEST_P(MediaRecorderEncoderWrapperTest,
EncodesTwoFramesWithoutRecreatingEncoder) { … }
TEST_P(MediaRecorderEncoderWrapperTest,
EncodeTwoFramesAndDelayEncodeDoneAndOutputCB) { … }
TEST_P(MediaRecorderEncoderWrapperTest, RecreatesEncoderOnNewResolution) { … }
TEST_P(MediaRecorderEncoderWrapperTest, HandlesInitializeFailure) { … }
TEST_P(MediaRecorderEncoderWrapperTest, HandlesEncodeFailure) { … }
TEST_P(MediaRecorderEncoderWrapperTest, HandlesFlushFailure) { … }
TEST_P(MediaRecorderEncoderWrapperTest, NotCallOnEncodedVideoCBIfEncodeFail) { … }
TEST_P(MediaRecorderEncoderWrapperTest,
NotErrorCallbackTwiceByTwiceEncodeDoneFailure) { … }
TEST_P(MediaRecorderEncoderWrapperTest, IgnoresEncodeAfterFailure) { … }
TEST_P(MediaRecorderEncoderWrapperTest, InitializesAndEncodesOneAlphaFrame) { … }
TEST_P(MediaRecorderEncoderWrapperTest,
InitializesAndEncodesOneOpaqueFrameAndOneAlphaFrame) { … }
INSTANTIATE_TEST_SUITE_P(…);
}